I have such code on server(NodeJs)... I'm using socketio-jwt npm module.How could I add rooms or other namespaces to the socket?! I tried 'io.sockets.of' but it seems not to be not correct?!
io.sockets
.on('connection', socketioJwt.authorize({
secret: config.secret,
callback: false
}))
//Success login
.on('authenticated', socket => {
console.log('connect')
//some work
socket
.on('add-message', chatMessageHandler)
.on('disconnect', disconnectHandler)
function chatMessageHandler(message) {
io.emit('message', {...}});
}
//Disconnect
function disconnectHandler() {
console.log('disconnect')
//
}
})
via pavlos
No comments:
Post a Comment