I wrote an online multiplayer turn based game which uses socket.io as transport mechanism. But the problem is that when I want to change some code in application it must be restarted and this causes socket connections disconnect and reconnect so the game flow including timers, state & ... will be corrupt. How can I handle this situation?
I tried to write a reset handler module:
http.listen(port, () => {
const argv = process.argv.slice(2)
if (argv[0] === 'platform-Master') {
const resetHandler = require('./reset-handler')()
setTimeout(async () => {
await resetHandler.findOpenGames()
}, 3000)
}
})
But it only works on single process not a cluster or at scale.