Constructors

Properties

WebSocketPolyfill: any
_on: any
ackedVersion: any
attemptToConnect: any

Attempts to connect to the websocket. Returns a promise that resolves to true if the connection was successful, or false if the connection failed.

authEndpoint: any
awareness: Awareness

Awareness protocol instance.

bindWebsocket: any
broadcastAwareness: any
checkSync: any
clearConnectionTimeout: any
clearHeartbeat: any
clientToken: null | ClientToken

Current client token.

connectionTimeoutHandle: any
doc: any
docId: any
ensureClientToken: any
handleAwarenessUpdate: any
heartbeatHandle: any
incrementLocalVersion: any
indexedDBProvider: any
isConnecting: any

Whether we are currently in the process of connecting.

listeners: any
localVersion: any
offline: any
online: any
queryAwareness: any
receiveMessage: any
receiveSyncMessage: any
receivedAtLeastOneSyncResponse: any

Older versions of the Y-Sweet server did not support the sync message, and would ignore it. This may lead to the client thinking the server is offline, when really it just doesn't know how to return a heartbeat.

Eventually, we will build protocol version negotiation into the handshake. Until then, we use a simple approach: until we receive the first sync message back, we assume the server is an older version for the purpose of the heartbeat logic.

reconnectSleeper: any
resetHeartbeat: any
retries: any
send: any
setConnectionTimeout: any
setStatus: any
status: YSweetStatus

Connection status.

syncStep1: any
update: any
updateAckedVersion: any
updateAwareness: any
websocket: any
websocketClose: any
websocketError: any
websocketOpen: any

Accessors

  • get hasLocalChanges(): boolean
  • Whether the document has local changes.

    Returns boolean

  • get shouldConnect(): boolean
  • Whether the provider should attempt to connect.

    Returns boolean

    Deprecated

    use provider.status !== 'offline' instead, or call provider.connect() / provider.disconnect() to set.

  • get synced(): boolean
  • Whether the document is synced. (For compatibility with y-websocket.)

    Returns boolean

    Deprecated

    use provider.status === 'connected' instead.

  • get wsconnected(): boolean
  • Whether the underlying websocket is connected.

    Returns boolean

    Deprecated

    use provider.status === 'connected' || provider.status === 'handshaking' instead.

  • get wsconnecting(): boolean
  • Whether the underlying websocket is connecting.

    Returns boolean

    Deprecated

    use provider.status === 'connecting' instead.

Methods

  • Returns Promise<void>

  • Returns void

  • Returns void

  • Parameters

    • eventName: YSweetEvent | YWebsocketEvent
    • Optional data: any

    Returns void

  • Parameters

    • clientToken: ClientToken

    Returns string

  • Parameters

    • type: YSweetEvent | YWebsocketEvent
    • listener: ((d) => void)
        • (d): void
        • Parameters

          • d: any

          Returns void

    Returns void

  • Parameters

    • type: YSweetEvent | YWebsocketEvent
    • listener: ((d) => void)
        • (d): void
        • Parameters

          • d: any

          Returns void

    Returns void

  • Parameters

    • type: YSweetEvent | YWebsocketEvent
    • listener: ((d) => void)
        • (d): void
        • Parameters

          • d: any

          Returns void

    Returns void