3

If I understand correctly, Heroku restart the application every day. This is called cycling the dyno.

I'm currently making multiplayer game using websocket.

Basically, when the daily cycling happens, every player on the server gets disconnected from the game. I do get 10 seconds to save player progress but it's still unacceptable that everyone gets disconnected.

How am I supposed to deal with that?

RainingChain
  • 7,397
  • 10
  • 36
  • 68

1 Answers1

4

You'll need to implement reconnect logic, which there are a couple solutions for in this question.

To avoid a gap while the server is restarting, turn on Heroku preboot. This spins up the new dynos, then switches to them before shutting down the old dynos, so there's no downtime.

heroku features:enable -a myapp preboot
Kristján
  • 18,165
  • 5
  • 50
  • 62
  • NB: Heroku doesn't preboot your dynos upon the daily cycling, only with a new deployment. – dmur Jan 24 '17 at 17:58
  • Preboot does apply during the nightly reboot, as well as when you restart via the CLI. Otherwise, I would get outage alerts every night :) – Kristján Jan 24 '17 at 19:51