Meteor Server Websites

I want to create a Meteor Server website (not a client) to connect to an external site . I know the url I'm going to go to and also what data to expect, but I'm not quite sure how exactly to create the website itself. All my searches present me with solutions for a client, but I have yet to come across anything that serves as a server solution.

Is there anything I missed that fills in this target? Atmosherejs.com doesn't list anything, and a google / github search didn't find anything either. Is there something built into Meteor that already accomplishes this?

+3


source to share


1 answer


The following code is for opening Socket in Meteor on Port 3003. It converts data from socket (sendet from client) to JSON-Object. So this means that the following code is a socket that receives JSON.



Fiber = Npm.require('fibers')

// server
Npm.require('net').createServer(function (socket) {
    console.log("connected");

    socket.on('data', function (data) {

        socket.write("hello!");

        var o = JSON.parse(data.toString());
        console.log(o);


        Fiber(function() { 
            console.log('Meteor code is executing');
            //=> Meteor code
        }).run();
        //console.log(data.toString());
        //socket.close();
    });
})

.listen(3003);

      

0


source







All Articles