@ezez/ws-server - v0.5.0
    Preparing search index...

    Type Alias OnCallback<Srv, Ev>

    OnCallback: EventsToEventEmitter<
        InferInOutCtx<Srv>[0],
        EZEZServerClient<
            InferInOutCtx<Srv>[0],
            InferInOutCtx<Srv>[1],
            InferInOutCtx<Srv>[2],
        >,
    >[Ev]

    Utility type for typing event handler callbacks that can be defined outside of inline client.on() calls.

    Type Parameters

    • Srv extends EZEZWebsocketServer<any, any, any>

      The server type (use typeof yourServerInstance)

    • Ev extends keyof InferInOutCtx<Srv>[0]

      The event name (must be a key of IncomingEvents)

    const ws = new EZEZWebsocketServer<IncomingEvents, OutgoingEvents>(...);

    const ping2Handler: OnCallback<typeof ws, "ping2"> = (args, reply, ids) => {
    // args, reply, etc. are typed
    };

    client.on("ping2", ping2Handler);