Socket.io: How to handle closing connections?

前端 未结 1 658
[愿得一人]
[愿得一人] 2020-12-29 07:14

I\'m trying to understand which are the \"physical\" limits of my application.

On the client side:

var socket = io.connect(\"http://127.0.0.1:6701\")         


        
相关标签:
1条回答
  • 2020-12-29 07:35

    It's better if client sends a "terminate" command to server which then closes the connection, than the other way around.

    Server will always wait until a timeout before giving up on a connection. Even if that timeout is small, with loads of connections coming in, it will overload it. That's why, for example, is always good to disable keep-alive on app servers.

    Delay helps because server has time to close the connection before opening a new one.

    0 讨论(0)
提交回复
热议问题