Skip to content

WebsocketProvider needs to wait to send sync step 1 until after it knows the server is listening #94

@astnmsn

Description

@astnmsn

Checklist

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:

  1. Add delay to server between websocket connection and listening to events on the websocket
  2. Observe client send sync step 1
  3. Message is never processed by the server
  4. Server sends sync step 1
  5. 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?

Huly®: YJS-515

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions