pepper
pepper copied to clipboard
Restore connection on reconnect
Websockets can be flakey and the idea of the websocket dropping out for even a moment would be disastrous. I believe this can easily be resolved by:
- When a client connects it should send an identifier back.
- The connections should be held in a global map. Only expiring/removing connections sometime after they have disconnected (like 10 minutes, or more).
- When a client connects with a previous identifier it can use that connection instead of calling the newConnectionFn.
This way all state is maintained through dropouts.