Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Websockets VS Server Sent Events(SSE) based on performance

I am aware of the difference between the two. Using WebSockets one can have bidirectional communication but with SSE only data can be pushed to browser. But at the same time, web sockets are heavy.

I am implementing a small game which will be played by 8-10 users simultaneously. I need to update the UI of all other players, whenever someone makes a move. Player's interaction with the game is minimal. In this case, should I go with Websockets for the two-way interaction or SSE for updating the browser and POST requests from the browser to the server whenever a player makes a move. Which will be more efficient performance and load wise on the server. My backend is in Django and I will be using Django channels for SSE or Websockets.

like image 677
Shubham Avatar asked Oct 18 '22 18:10

Shubham


1 Answers

"Websockets and Server sent events were in the experiments measured to have very similar performance and they were measured to be the most performance efficient of the compared technologies in the experimental conditions used in this study. This suggests that to increase server performance and reduce hardware costs these technologies would be better than the other technologies compared. "

Performance comparison of XHR polling, Long polling, Server sent events and Websockets

like image 86
Firat Faruk EREN Avatar answered Oct 21 '22 03:10

Firat Faruk EREN