Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

web socket, max clients?

In a single page application: When using ajax, the ajax request gets the data and the connection is closed. This allows thousands of users to use the system.

In web sockets, each "page" opens a socket connection (to a namespace) and keeps it live however this has thousands of idle connections, this can't be good for performance?

Also, doing tests on firefox, the ajax connection is 20ms latency while each call in socket.io connection is 200ms.

like image 493
firebird Avatar asked Jun 29 '26 09:06

firebird


1 Answers

You have to consider what's your situation. WebSockets aren't an alternative to Ajax, they serve a different purpose. WS are good when you need long running connections, for example when you are making chats or real-time websites (like livescore for ex.)

If you are wondering how many connections can Socket.IO handle, there is a similar question here (short version: depends on hardware):

Socket.io: How many concurrent connections can WebSockets handle?

like image 191
alessioalex Avatar answered Jul 01 '26 23:07

alessioalex