@refinio/one.models
    Preparing search index...

    This class manages and authenticates incoming connections.

    This class also ensures, that there aren't multiple listeners listening on the same socket, which would lead to errors.

    Index

    Constructors

    Properties

    onConnection: OEvent<
        (
            conn: default,
            localPublicKey: PublicKey,
            remotePublicKey: PublicKey,
            listenerId: string,
        ) => void,
    > = ...

    Event is emitted when E2E connection is setup correctly. The event will pass the connection to the listener.

    onOnlineStateChange: OEvent<(online: boolean) => void> = ...

    Event is emitted when the state of the connector changes. The listener callback will be called in order to have access from outside to the errors that occur on the web socket level.

    Accessors

    Methods

    • Listen for connections using a communication server.

      Parameters

      • commServerUrl: string

        The communication server to use. (URL is passed to WebSocket)

      • cryptoApi: CryptoApi
      • OptionallistenerIdPrefix: string

        The prefix to add before the listener id

      Returns Promise<() => Promise<void>>

    • Listen for direct connections.

      This function will start a listening websocket server only the first time this function is called with the same host / port / localPublicKey options. All following calls will just increase a reference counter, but not start a listening

      Parameters

      • host: string
      • port: number
      • cryptoApi: CryptoApi
      • OptionallistenerIdPrefix: string

        The prefix to add before the listener id

      Returns Promise<() => Promise<void>>

    • Parameters

      • commServerUrl: string
      • cryptoApi: CryptoApi
      • listenerId: string

      Returns Promise<CommServerListenerInfo>

    • Parameters

      • commServerUrl: string
      • localPublicKey: LocalPublicKey
      • OptionallistenerIdPrefix: string

      Returns string