Type alias recoverConnectionCallback

recoverConnectionCallback: ((lastConnectionDetails: { clientId: string | null; disconnectedAt: number; location: string; recoveryKey: string }, callback: recoverConnectionCompletionCallback) => void)

Type declaration

    • (lastConnectionDetails: { clientId: string | null; disconnectedAt: number; location: string; recoveryKey: string }, callback: recoverConnectionCompletionCallback): void
    • Used in ClientOptions to configure connection recovery behaviour.

      Parameters

      • lastConnectionDetails: { clientId: string | null; disconnectedAt: number; location: string; recoveryKey: string }

        Details of the connection used by the connection recovery process.

        • clientId: string | null

          The clientId of the client’s Auth object before the page was unloaded. A common use case for this attribute is to ensure that the current logged in user’s clientId matches the previous connection’s clientId before allowing the connection to be recovered. Ably prohibits changing a clientId for an existing connection, so any mismatch in clientId during a recover will result in the connection moving to the failed state.

        • disconnectedAt: number

          The time at which the previous client was abruptly disconnected before the page was unloaded. This is represented as milliseconds since Unix epoch.

        • location: string

          A clone of the location object of the previous page’s document object before the page was unloaded. A common use case for this attribute is to ensure that the previous page URL is the same as the current URL before allowing the connection to be recovered. For example, you may want the connection to be recovered only for page reloads, but not when a user navigates to a different page.

        • recoveryKey: string

          The recovery key can be used by another client to recover this connection’s state in the recover client options property. See connection state recover options for more information.

      • callback: recoverConnectionCompletionCallback

        A callback which is called when a connection recovery attempt is complete.

      Returns void

Generated using TypeDoc