Question

I have different channels in my socket.io implementation and there will be a LOT of data exchanged with the clients connected to those channels. So i am a bit confused as to should i use the namespace concept in socket.io which creates separate namespaces for each channel under the same socket connection or should i create different socket connections on different ports for each channel? Please give me suggestion as to how these two options will affect the performance etc?

Thanks

Was it helpful?

Solution

Namespaces seems like a better idea than tying up multiple sockets unnecessarily. The amount of data you can send back and forth will be limited by the overall bandwidth capacity. Opening new socket connections won't magically increase throughput unless the sockets connect to different machines, or if the single socket is used inefficiently (i.e. synchronous/blocking activity).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top