Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to use of socket io on a route in nodejs

router.post('/getRides', function(req, res, next) {
    var io = req.app.get('socketio');

    io.to(//socket.id//).emit("message", data);

    db.rides.find(function(err, docs) {
        res.json(docs);
    });
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #socket #io #route #nodejs
ADD COMMENT
Topic
Name
5+9 =