Search code examples
architectureservernetwork-programmingdistributed-computingchatroom

Why they use two long WS connection every user to implement a chat room


Here is a design of a chat room. They using two long ws connection in the client side. One for up going, and one for down going? What is the benefit of such design.

This company having very large concurrency. Recently, they shared they design of the chat room. They can handle 100,000+ concurrency in same room.

I think that maybe caused by the need of using different IDC, the up going connection is connecting to the IDC where the main DB is at that IDC. Easy to implement the business logic.

What is your opinion?enter image description here


Solution

  • I found the presentation video: https://v.qq.com/x/page/s0348ife1pn.html

    According to the presentation, I know that they want anther WS long living connection to send and receive the user`s own message in the room.

    One for broadcasting, and one for own quick message response, to make good user experience, even when the broadcasting channel`s network transaction is very heavy.