io.sockets.socket(socketId) is gone?
See original GitHub issueIn the 0.9.x, we can use io.sockets.socket(socketId)
, but in 1.0.x, it’s gone.
How to find a socket by id in 1.0.x?
Issue Analytics
- State:
- Created 9 years ago
- Comments:16 (1 by maintainers)
Top Results From Across the Web
javascript - How to get the socket id when parsing through io ...
As of socket.io v3, io.sockets is now a Map object as shown here. You can iterate it directly with: for (let [id, socket]...
Read more >Server API - Socket.IO
A reference to the underlying Engine.IO server. See here. server.sockets. <Namespace>. An alias for the main namespace ( / ).
Read more >How to manage users in socket.io in Node.js ? - GeeksforGeeks
Approach: First, it is important to note that when a new socket is created, it is assigned a unique Id which is retrieved...
Read more >Impossible to get socket.io from a Express route
io.sockets.socket(socket.id).emit('formPost', { success: true, msg: 'You win!'} ); ... There's a great blog post on the wiki that goes into greater depth
Read more >Socket.IO - Quick Guide - Tutorialspoint
It involves polling the server for changes, keeping track of timestamps, and it is a lot slower than it should be. Sockets have...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
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
Thank you @rsdrsd ,
io.to(socket.id).emit()
is what I want. I think the official docs didn’t introduce thisio.to(socketId)
method clearly.@darrachequesne Thanks for the explanation, I have learn so many things with nodejs REPL and found that I can do this for the alternative… I’ll leave this here if someone have a same problem like me…
io.sockets.sockets[targetSocketID].join(roomID)