Skip to main content

Module sync

Module sync 

Source
Expand description

Yjs Sync Protocol Implementation

This module implements the y-websocket sync protocol for compatibility with Hocuspocus/y-websocket clients. The protocol flow is:

  1. Client connects and sends SyncStep1(client_state_vector)
  2. Server responds with SyncStep2(server_diff) + SyncStep1(server_state_vector)
  3. Client sends SyncStep2(client_diff)
  4. Ongoing: Both sides exchange Update messages

Note: Awareness protocol (for cursors/presence) is handled by forwarding messages between clients without server-side state.

Structs§

DocHandler
A handler for a single Yjs document/room Manages the document state, persistence, and broadcasting

Constants§

MSG_AUTH
MSG_AWARENESS
MSG_QUERY_AWARENESS
MSG_SYNC
Message types for y-websocket protocol The first byte of each message indicates its type