We are implementing a service which is used by a lot of users in the same time. In peaks we can have tens of thousands of people online.
Critical part of our service needs reimplementation and so we try to think of new ways of doing it. At the moment we send simple and very short/small AJAX HTTP request based on user interaction:
- Ping: I am still active
- Activity: I have done this and please write it to the database
- Finishing: I have finish my activities so close my requests
At the same time, in some case (1 in 10) we have open EventSource
from which we read some modifications on the server.
The question is whether this model is good enough or if it is better to open a WebSocket and pass everything via WebSockets.
- Advantage – for each user we would maintain only one connection instead of sending multiple requests.
- Disadvantage - when lots of people online, we would keep thousands of connections active
What should be the decision for the right implementation?
It was noted that this question answers the same: WebSockets protocol vs HTTP – however I ask for specific use-case. The related question is rather asked in general.