Documentation
    Preparing search index...

    Interface WebSocketContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase>

    Context for raw WebSocket handlers (onWebSocket).

    interface WebSocketContext<
        TState,
        TConnParams,
        TConnState,
        TVars,
        TInput,
        TDatabase extends AnyDatabaseProvider,
    > {
        conn: Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase>;
        request: Request | undefined;
        get abortSignal(): AbortSignal;
        get actorId(): string;
        get conns(): Map<
            string,
            Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase>,
        >;
        get db(): InferDatabaseClient<TDatabase>;
        get key(): string[];
        get log(): Logger;
        get name(): string;
        get region(): string;
        get schedule(): Schedule;
        get state(): TState;
        get vars(): TVars;
        broadcast<Args extends unknown[]>(name: string, ...args: Args): void;
        client<R extends Registry<any>>(): Client<R>;
        saveState(opts: SaveStateOptions): Promise<void>;
        sleep(): void;
        waitUntil(promise: Promise<void>): void;
    }

    Type Parameters

    • TState
    • TConnParams
    • TConnState
    • TVars
    • TInput
    • TDatabase extends AnyDatabaseProvider

    Hierarchy

    Index

    Properties

    request: Request | undefined

    The incoming HTTP request that initiated the WebSocket upgrade. May be undefined for WebSocket connections initiated without a direct HTTP request.

    Accessors

    Methods