@nestjs/websockets
Version:
WebSockets for NestJS: gateways with message handlers, guards, pipes and interceptors, on Socket.IO or ws.
33 lines (32 loc) • 1.65 kB
TypeScript
import { GatewayMetadata } from './interfaces/gateway-metadata.interface.js';
import { ServerAndEventStreamsHost } from './interfaces/server-and-event-streams-host.interface.js';
import { SocketsContainer } from './sockets-container.js';
import type { ApplicationConfig } from '@nestjs/core';
export declare class SocketServerProvider {
private readonly socketsContainer;
private readonly applicationConfig;
private readonly hasHttpServer;
private readonly logger;
private readonly serverOptions;
constructor(socketsContainer: SocketsContainer, applicationConfig: ApplicationConfig, hasHttpServer?: boolean);
scanForSocketServer<T extends GatewayMetadata = any>(options: T, port: number, gatewayName?: string): ServerAndEventStreamsHost;
private createSocketServer;
private isServedWithoutListener;
/**
* A gateway that joins a server created for another gateway is served with
* the options of that gateway. A connection check of its own would never
* run, and every client would reach its handlers, so the application does
* not start. Other options it would lose are reported.
*/
private ensureOptionsApply;
private decorateWithNamespace;
private getServerOfNamespace;
/**
* WsAdapter serves "events", "/events" and "/events/" on the same path, and
* the server is created with the normalized path on every adapter, so
* gateways that spell the path differently share one server, as they do for
* a namespace. A second server on the same path would never get a client.
*/
private normalizeServerPath;
private validateNamespace;
}