substance / notes

Real-time collaborative notes editing.
Other
21 stars 5 forks source link

Implement reconnect if connection is closed during editing. #11

Closed michael closed 8 years ago

michael commented 8 years ago

If a websocket connection gets closed, we need to create a new websocket in order to reconnect. I will handle this on app level and reconnect the CollabSession each time. Maybe with a delay of 5s for each reconnect attempt.

obuchtala commented 8 years ago

sounds good :+1:

michael commented 8 years ago

Done. However we need to fix our dev setup (examples) and test suite accordingly.

obuchtala commented 8 years ago

Great! Just give a short summary of what needs to be done for that. Thx!

michael commented 8 years ago

It's just that the CollabSession interface changed a bit. It no longer takes the websocket immediately. Instead, an explicit open call (which takes a ws) connects a session to the remote. In the reconnect case we call this open function again and pass the new websocket. It requires the websocket to be open already, otherwise will throw an error.

https://github.com/substance/notepad/blob/multi-doc-support/notepad/app.js#L89-L101

obuchtala commented 8 years ago

Ok. Thx!

michael commented 8 years ago

Oh and in order to test reconnect. Just kill the server while the session is running and watch the console. Once you start the server again a reconnect happens.

michael commented 8 years ago

Well but first I need to implement the collaborators display.

michael commented 8 years ago

Done.