I am doing Comet chat with Erlang. I use only one connection (long polling) to transport messages. But, as you know, a long-term connection cannot stay in touch all the time. Each time a new message arrives or reaches a timeout, it is interrupted and then reconnected to the server. If the message was sent before reconnecting, it is a problem of maintaining the integrity of the chat.
In addition, if a user opens more than one window with Comet-chat, all chat messages must be synchronized, which means that the user can have many long requests. Therefore, it is difficult to transmit all messages in a timely manner.
Should I create a message queue for each connection? Or what is the best way to solve this problem?
source share