emitting to a room doesn't work for namespaced clients
See original GitHub issueFailing
io.of('/foo').on('connection', function(client) {
client.join('aaa');
this.in('aaa').emit('goes to noone since packet endpoint is set to "/foo/aaa", instead of "/foo" and room: "aaa"')
})
Working
io.of('').on('connection', function(client) {
client.join('aaa');
this.in('aaa').emit('goes to aaa members since packet endpoint is set to "aaa"')
})
Issue Analytics
- State:
- Created 12 years ago
- Comments:14 (3 by maintainers)
Top Results From Across the Web
socket.io emitting to all clients works, but emitting to room ...
When I try io.emit() , the message gets emitted to everyone but when I try io.to(room).emit() , the message doesn't get emitted (In...
Read more >Rooms | Socket.IO
A room is an arbitrary channel that sockets can join and leave. It can be used to broadcast events to a subset of...
Read more >Socket.io Namespaces and Rooms - LinkedIn
This emit signal is sent automatically by the client. Next I'll discuss the similarities and differences between Namespaces and Rooms, two ...
Read more >Node.js Socket.io Namespaces, Rooms and Connections 02
And make sure to specify the namespace using the io.of method whenever you want to access the sockets or emit/add listeners. . As...
Read more >Node.js Socket.io Namespaces, Rooms and Connections 02
Written Tutorial: https://go.ipenywis.com/ipenyb79ca--- Official Links----Official Website: http://ipenywis.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I figured it out. Basically, when emitting to namespaced rooms you also need to define the namespace.
Still not solved in 2018! socket.io 2.1.0, why?!