Skip to content

websocket reconnection #3110

Discussion options

You must be logged in to vote

You would have to run an Arena { active_sessions: Vec<Addr<MySession>> } that all WebSockets connect to.

  1. If the client is new: give it a random secret string. eg. 32 random Bytes to hold on to and store it in MySession as well
  2. The WebSocket disconnects, but the MySession keeps itself alive with a timer, eg. for 5min
  3. If the client reconnects within that time, it sends the random secret and the WebSocket actor can find the MySession with the secret or not if it is too late

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@xingsongs
Comment options

Answer selected by xingsongs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants