showing results for - "how to use of socket io on a route in nodejs"
Silvana
03 Nov 2020
1//Using Express 4, in your app.js file you can use
2app.set('socketio', io);
3
4//then in your router you can access it like this
5router.post('/getRides', function(req, res, next) {
6    var io = req.app.get('socketio');
7
8    io.to(//socket.id//).emit("message", data);
9
10    db.rides.find(function(err, docs) {
11        res.json(docs);
12    });
13};
Alisa
31 Jul 2020
1router.post('/getRides', function(req, res, next) {
2    var io = req.app.get('socketio');
3
4    io.to(//socket.id//).emit("message", data);
5
6    db.rides.find(function(err, docs) {
7        res.json(docs);
8    });
9};
queries leading to this page
connect socket io with nodejshow to use node socket io in real time app exampleexport and used in router socket io node js expressnodejs socket io on specific route onlymake a socket io socket in nodejshow to use socket io in express js with routersocket io in nodejs express for real timenode js how to use socket iohow to create different routes in socket io application socket io in express routeradd socket io to express routeuse socket io inside an api route expressuse socket io in nodejsnode route socket iowhy use socket io in routes of expressjsexpress and socket io use socket on routerhow to use socket io in node jsimplement socket io in nodejssocket io over express routehow to use socket io in express router node js for client socket iosocket io with routenode js socket how to use socket io through get in expressusing socket io in express routechat socket io expressusing routes in nodejs for socketiosocket io on routeaccess socket io from router expressnode connect to socket iousing routes inside socket iohow to use socket io in routessocket routing node jshow to use socket io in express routessocket io in express routeshow to connect socket io to node routessocket io on certain routessocket io connect nodejsnode js web how to use socket iousing socket io with express routinguse socket io in route controller pattern nodejshow to setup socket io in nodejsmake socket io socket from noejssocket io setting with node js expressnode js socket io with browsersocket io io instance in express routessocket io route npmsocket io express routersocket node js listensocket io node make connect from node jssocket io with router define howhow to use socket io in another routes of expressjssocket io in express routessocket io setup in express nodejssetting route inside socketsockets io nodejsnode js socket io express routerconfiguring socket io in node jsnode js sockets vs routesbest way to implement socket io in node jscall socket io in nodejsusing express router inside socket iohow to use socket io in different routes of expressjssocket io node js routershow to use socket io in different routes of expressjsget socket io in routesocketio how to accept any routehow to create use in socket io with express jswhy use socket io in routes of express jshow is socket io different from express routingconnect api app to socket io node jssocket io nodejs routessocket nodejs listensocket io router expresshow to connect node js with socket iohow to have a client node js of socket iowhat is the main use of socket io in node jshow to use socket io instance in express routehow to use socket io with express routehow to use router get socket iosocket io js and routershow to use socket io with nodejshow to use router with socket iohow to work nodejs with socket io 3fsocket io with express routeruse socket io with express routesadd socket io to node js exampledo i need to create route in socket iosocket io 2b express routehow to use of socket io on a route in node jssocket io routesexpress router with socket ioroutes in socket ioexpress 4 socket io with routersocket io with express routernodejs socketio routerhow to use socket io with expressuse socket io in an express apphow to add socket io to ur node appuse socket io inside a route in expresshow to get location with socket io in node jsusing socket io with express routerconnect to socket io nodejsconnecting to node with socket iorouting socket io expressuse socket io on route page nodejsuse socket io in routesocket io connect to express routenodejs set up socket iohow to use socket io in another routes of expressjs and 22socket id 22using socket io in expresssocket io routes expresshow to use socket io in nodejsvue socket ioby using socket getting socket io in routesocket io on a specific route expressusing socket io in routeshow to use socket io in router fileio socket connections on node routessocket io express routersocket io setup in expressjssockets on expres routerlisten to socket io routes expressexpress socket io pathuse socket io in routesnodejs socket io with routeruse socket io with routessocket io with routerhow do i use a socket io client in node 3fsockets or routes nodejsexpress router socket iosocket io connect node js to clientnode js with socket iorouter get use socket iohow to use of socket io on a route in nodejssocket io express rohow to use socket io in nodejsusing sockets io with nodesocket io and express routerhow to use of socket io on a route in nodejs