UNPKG

@rtco/server

Version:
61 lines (57 loc) 1.52 kB
// Generated by dts-bundle-generator v9.5.1 import { Server as NodeServer } from 'node:http'; import { Http2SecureServer, Http2Server } from 'node:http2'; import { Server as HTTPSServer } from 'node:https'; import { Server, ServerOptions } from 'socket.io'; declare enum LogLevel { /** * Prints no logs. */ Disabled = 0, /** * Prints only errors. */ Errors = 1, /** * Prints errors and warnings. */ Warnings = 2, /** * Prints info, errors and warnings. */ Info = 3, /** * Prints all logs (Info + Debug). */ All = 4 } export type HttpServerInstance = NodeServer | HTTPSServer | Http2Server | Http2SecureServer; export interface ArticoServerOptions { /** * The log level for the server. * @default LogLevel.Errors */ debug: LogLevel; /** * Options for creating the Socket.IO server. * @default { transports: ["websocket"], cors: { origin: "*" } } */ ioOptions: ServerOptions; /** * An existing HTTP server to attach the Socket.IO server to. */ httpServer: HttpServerInstance; } export interface IArticoServer { /** The underlying Socket.IO server */ get server(): Server; /** Start listening on the specified port */ listen(port: number): void; } export declare class ArticoServer implements IArticoServer { #private; constructor(options?: Partial<ArticoServerOptions>); get server(): Server<import("socket.io").DefaultEventsMap, import("socket.io").DefaultEventsMap, import("socket.io").DefaultEventsMap, any>; listen: (port: number) => void; } export {};