0

This is a question I can't seem to find an answer to easily.

Related to socket.io

If a client connects to socket server, and the server subscribes them to a room, but the browser client is not listening to the events from that room, does the network packet / data still get sent to the client and just ignored since it is not listening? Or does the server not send at all?

Use Case: I have a room I subscribe all my users to, but in some areas of my app they are not listening for any events, or not listening to specific channels / rooms in the browser side code.

If I have a special channel for a near real time update or message that is sent to that room, but only 1 person out of everyone is listening on the browser side, is everyone still getting slammed by network traffic even though it was only meant for that user?

geilt
  • 807
  • 8
  • 9
  • What messages do you see on the websocket in dev tools when the client isn't listening to the event? – Matt Jul 22 '22 at 06:28
  • TCP will eventually fill the receiver's buffer and the sender's buffer. At that point the sender will block on send, or else get EAGAIN/EWOULDBLOCK if in non-blocking mode, or maybe time out if in asynchronous mode. – user207421 Jul 22 '22 at 07:46
  • I did a test, and indeed, if the socket server user is subscribed to the room and the browser is not "listening" to that room the browser it still gets the packets and just ignores any action. This can still cause a sudden flood of network activity for a user even if they aren't doing anything with the information sent to the room. – geilt Oct 17 '22 at 18:59

0 Answers0