-
-
Notifications
You must be signed in to change notification settings - Fork 311
Description
Checklist
- Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/
- Try to report your issue in the correct repository. Yjs consists of many modules. When in doubt, report it to https://github.com/yjs/yjs/issues/
Describe the bug WebsocketProvider needs to wait to send sync step 1 until after it knows the server has setup its listener (has received sync step 1 from the server)
To Reproduce Steps to reproduce the behavior:
- Add delay to server between websocket connection and listening to events on the websocket
- Observe client send sync step 1
- Message is never processed by the server
- Server sends sync step 1
- Client never reaches 'synced' state because the server never responds to the client's sync step 1 (because the server wasn't listening at the time) with the proper next step
Expected behavior Client and server exchange sync step 1 messages, and server initiates the next step after processing the client's first step
Screenshots None
Environment Information
- Browser & Node server
- "y-websocket": "1.3.18"
- "yjs": "13.5.24"
Additional context We are executing some async code as part of the handleUpgrade callback. This is causing delays with setting up the message listener on the websocket connection. There may be another way to handle this, but I found that moving the send of sync step 1 from the client into the handler for messageSync when the message is of type 'messageYjsSyncStep1' solved the issue.
Maybe there is a better way to handle this on the server so it awaits sending the connect to the websocket?