简体   繁体   中英

Socket.io client connects to multiple servers at once

I'm using nodejs and socket.io and I'm curious. What if 1 client connects to multiple servers like so:

socket = io.connect('http://server1') //600k sockets already connected
socket2 = io.connect('http://server2') // 100k sockets already connected
socket3 = io.connect('http://server3') // 1 million sockets already connected
socket4 = io.connect('http://server4') // 999k sockets already connected

Will there be any performance issues for the server or client? Will the client be able to maintain all the connections with already so many connected?

I like absurd scenarios as it helps me to better understand whats going on.

Will there be any performance issues for the server or client?

For every connection there is a slight overhead for heartbeats, handshakes and things like that but those shouldn't be measurable. Wether you send the data over one connection or two shouldn't matter, just the amount of data matters.

Will the client be able to maintain all the connections with already so many connected?

Sure, the only limits are memory and bandwith, which are both quite high these days.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM