import type { Application } from '../Application.js'; import { ServiceProvider } from '../ServiceProvider.js'; import { type WsClientMeta } from './WsClient.js'; import type { WsGateway } from './WsGateway.js'; export interface WsServiceProviderOptions { /** * The WsGateway subclass to instantiate and wire up. * Must be resolvable from `app.make(gateway)`. */ gateway: new (...args: never[]) => WsGateway; /** * Async function that validates a token string and returns decoded claims. * Throw any error to reject the upgrade with HTTP 401. * * @example * verifyToken: (token) => app.make(JwtProvider).verify(token) */ verifyToken: (token: string) => Promise; } /** * Registers the WebSocket server on the Node.js HTTP `upgrade` event. * JWT auth is performed before the ws handshake — invalid tokens close * the socket with status 401. * * Register before calling `app.listen()`: * @example * app.register(new WsServiceProvider({ * gateway: AppWsGateway, * verifyToken: (t) => app.make(JwtProvider).verify(t), * })) */ export declare class WsServiceProvider extends ServiceProvider { private readonly options; constructor(options: WsServiceProviderOptions); /** @param app - application instance */ register(app: Application): void; /** @param app - application instance */ boot(app: Application): void; } //# sourceMappingURL=WsServiceProvider.d.ts.map