express.io
express.io copied to clipboard
Need a way to trigger a route from another route
I have this example at app.js
app = require('../../../express.io')()
app.http().io()
app.io.route('posts', {
create: function(req) {
// Creates a post...
}
})
app.listen(7076)
Let's say that i have another route inside the app.js like this
app.io.route('client', {
createNewPost: function(){
// I need to trigger a posts route from here, but i need to do it using socket,
// because i need to trigger it on a SPECIFIC SOCKET,
// as i can't just route the requisiton, i can't use req.io.route('')
app.io.sockets.socket(socketTarget).emit('posts:create');
}
})
I need to trigger a posts route from here, but i need to do it using socket, because i need to trigger it on a SPECIFIC SOCKET, as i can't just route the requisiton, i can't use req.io.route('')