Interface UsePresenceParams

The options for the usePresence hook.

interface UsePresenceParams {
    enterWithData?: unknown;
    leaveWithData?: unknown;
    onConnectionStatusChange?: ((change: ConnectionStatusChange) => void);
    onDiscontinuity?: ((error?: ErrorInfo) => void);
    onRoomStatusChange?: ((change: RoomStatusChange) => void);
}

Hierarchy (view full)

Properties

enterWithData?: unknown

The data to enter the room with. Any JSON serializable data can be provided.

leaveWithData?: unknown

The data to leave the room with. Any JSON serializable data can be provided.

onConnectionStatusChange?: ((change: ConnectionStatusChange) => void)

Register a callback for when the connection status to Ably changes.

Type declaration

    • (change): void
    • Parameters

      Returns void

onDiscontinuity?: ((error?: ErrorInfo) => void)

Register a callback to detect and respond to discontinuities. For example, you might choose to fetch missing messages.

Type declaration

    • (error?): void
    • Parameters

      • Optionalerror: ErrorInfo

        The error that caused the discontinuity.

      Returns void

onRoomStatusChange?: ((change: RoomStatusChange) => void)

Register a callback for when the room status changes.

Type declaration

    • (change): void
    • Parameters

      Returns void