@fanoutio/grip
Version:
GRIP Interface Library
31 lines • 1.09 kB
TypeScript
import { type IWebSocketEvent } from './IWebSocketEvent.js';
export declare class WebSocketContext {
id: string;
_inEvents: IWebSocketEvent[];
opening: boolean;
accepted: boolean;
closeCode: number | null;
closed: boolean;
outCloseCode: number | null;
outEvents: IWebSocketEvent[];
origMeta: Record<string, string>;
meta: Record<string, string>;
prefix: string;
constructor(id: string, meta: Record<string, string>, inEvents: IWebSocketEvent[], prefix?: string);
isOpening(): boolean;
accept(): void;
close(code?: number): void;
canRecv(): boolean;
disconnect(): void;
recvRaw(): string | Uint8Array | null;
recv(): string | null;
send(message: string | Uint8Array): void;
sendBinary(message: string | Uint8Array): void;
sendControl(message: string | Uint8Array): void;
subscribe(channel: string): void;
unsubscribe(channel: string): void;
detach(): void;
getOutgoingEvents(): IWebSocketEvent[];
toHeaders(): Record<string, string>;
}
//# sourceMappingURL=WebSocketContext.d.ts.map