performancewebsocketconnectiononline-game

Online game's alive connections count


In online multiplayer games where the world around you changes frequently (user gets updates from the server about that) - how many alive connections usually are made?

For example WebSockets can be used. Is it an effective way to send all data through the one connection? You will have to check every received message type:

..etc.

I think this if .. else if .. else if .. else if .. for every incoming data decreases client-side performance very much. Wouldn't it be better to get world changes from the second WS connection? Then you won't have to check it's type every time. But another types are not so frequent, so the first connection can be for them.

So the question is how developers usually deal with connections count and message types to increase performance?

Thanks


Solution

  • It depends on clientside vs serverside load. You need to balance whether you want to place the load of having more open connections on the server, or the analysis of the payload on the client. If you have a simple game, and your server is terrible, I would suggest placing more clientside load. However, for high-performance gaming functioning with an excellent server, using more WebSockets would be the recommended approach.