Do HTML WebSockets maintain an open connection for each client? Does this scale?

前端 未结 5 1255
情歌与酒
情歌与酒 2020-11-28 00:36

I am curious if anyone has any information about the scalability of HTML WebSockets. For everything I\'ve read it appears that every client will maintain an open line of com

5条回答
  •  孤城傲影
    2020-11-28 01:08

    Think of it this way: what is cheaper, keeping an open connection, or opening a new connection for every request (with the negotiation overhead of doing so, remember it's TCP.)

    Of course it depends on the application, but for long-term realtime connections (e.g. an AJAX chat) it's far better to keep the connection open.

    The max number of connections will be capped by the max number of free ports for the sockets.

提交回复
热议问题