Leaf
    Preparing search index...

    A SuperPeer1 is a peer that accepts connections from any peer, syncs every Entity that it becomes aware of, and persists the entities to storage.

    It is meant to be run as a part of a sync server that can be used to persist and synchronize Entitys between multiple client peers, or possibly other super peers.

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Send an update for a given entity. This must be called to send local changes to remote peers.

      Parameters

      • entityId: `leaf:${string}`
      • update: Uint8Array

      Returns void

    • Subscribe to updates for a given entity.

      Every time the sync interface has an update for the entity it will call handleUpdate, passing it the entity ID and the update.

      Parameters

      • entityId: `leaf:${string}`

        The entity ID to subscribe to.

      • snapshot: Uint8Array
      • handleUpdate: Subscriber

        The handler function to be invoked when the sync interface has a new update.

      Returns () => void

      Returns a function that may be called to unsubscribe.