Differences between websockets and long polling for turn based game server Differences between websockets and long polling for turn based game server ios ios

Differences between websockets and long polling for turn based game server


For anyone else who may be wondering, it could depends on how long typical interactions go between events?

Websocket: Anything more than a few tens of seconds, I don't think keeping a websocket open is particularly efficient (not to mention that IIRC it would disconnect anyway if the app loses focus)

Long polling: This forces a trade-off between server load (anything new now? how about now? ...) and speediness of knowing a change has occurred.

Push notifications: While this may be technically more complex to implement, it really would be the best solution IMO, since:

  • the notification can be sent (and delivered) almost immediately after an event occurs
  • there is no standby server load (either from open websockets, or "how about now?" queries) - which is especially important as your use-base grows
  • you can override what happens if a notification comes in while the user is in-app