fastify-uws
Version:
A performant HTTP and WebSocket server for Fastify with uWebSockets.
42 lines (41 loc) • 1.43 kB
TypeScript
import { default as uws } from 'uWebSockets.js';
import { ServerOptions } from 'node:https';
import { EventEmitter } from 'eventemitter3';
import { FastifyServerFactoryHandler, FastifyServerOptions } from 'fastify';
import { kAddress, kApp, kClosed, kHandler, kHttps, kListen, kListenAll, kListening, kListenSocket, kWs } from './symbols';
import { WebSocketServer } from './websocket-server';
interface FastifyUwsOptions extends FastifyServerOptions {
http2?: boolean;
https?: ServerOptions | null;
}
export declare class Server extends EventEmitter {
[kHandler]: FastifyServerFactoryHandler;
timeout?: number;
[kHttps]?: FastifyUwsOptions['https'];
[kWs]?: WebSocketServer | null;
[kAddress]?: null | any;
[kListenSocket]?: null | any;
[kApp]: uws.TemplatedApp;
[kClosed]?: boolean;
[kListenAll]?: boolean;
[kListening]?: boolean;
constructor(handler: FastifyServerFactoryHandler, opts?: FastifyUwsOptions);
get encrypted(): boolean;
get listening(): boolean | undefined;
setTimeout(timeout: number): void;
address(): any;
listen(listenOptions: {
host: string;
port: number;
signal: AbortSignal;
}, cb: any): void;
closeIdleConnections(): void;
close(cb?: () => void): void;
ref(): void;
unref(): void;
[kListen]({ port, host }: {
port: any;
host: any;
}): Promise<unknown>;
}
export {};