Automerge Repo - v2.3.0-alpha.0
    Preparing search index...

    Class WebSocketClientAdapter

    Hierarchy

    • WebSocketNetworkAdapter
      • WebSocketClientAdapter
    Index

    Constructors

    • Parameters

      • url: string
      • OptionalretryInterval: number

      Returns WebSocketClientAdapter

    Properties

    onClose: () => void
    onError: (event: Event | ErrorEvent) => void

    The websocket error handler signature is different on node and the browser.

    onMessage: (event: MessageEvent) => void
    onOpen: () => void
    peerId?: PeerId
    peerMetadata?: PeerMetadata
    remotePeerId?: PeerId
    retryInterval: number
    socket?: WebSocket
    url: string
    prefixed: string | boolean

    Methods

    • Called by the Repo to start the connection process

      Parameters

      Returns void

      peerId - the peerId of this repo

      peerMetadata - how this adapter should present itself to other peers

    • Called by the Repo to disconnect from the network

      Returns void

    • Return an array listing the events for which the emitter has registered listeners.

      Returns (keyof NetworkAdapterEvents)[]

    • Returns boolean

    • Returns void

    • Return the number of listeners listening to a given event.

      Parameters

      Returns number

    • Return the listeners registered for a given event.

      Type Parameters

      Parameters

      • event: T

      Returns (
          (
              ...args: ArgumentMap<NetworkAdapterEvents>[Extract<
                  T,
                  keyof NetworkAdapterEvents,
              >],
          ) => void
      )[]

    • Parameters

      Returns void

    • Parameters

      • messageBytes: Uint8Array

      Returns void

    • Remove all listeners, or those of the specified event.

      Parameters

      • Optionalevent: keyof NetworkAdapterEvents

      Returns this

    • Remove the listeners of a given event.

      Type Parameters

      Parameters

      Returns this

    • Called by the Repo to send a message to a peer

      Parameters

      Returns void

      message - the message to send

    • Returns Promise<void>