UNPKG

@socket.io/postgres-adapter

Version:

The Socket.IO Postgres adapter, allowing to broadcast events between several Socket.IO servers

27 lines (26 loc) 1.04 kB
import { type Pool } from "pg"; import { type PostgresAdapterOptions } from "./adapter"; import { type ClusterMessage, ClusterResponse } from "socket.io-adapter"; export declare function hasBinary(obj: any, toJSON?: boolean): boolean; export declare function randomId(): string; export type ExtendedClusterMessage = ClusterMessage & { nodeId: string; attachmentId?: string; }; export declare class PubSubClient { private readonly pool; private readonly opts; private readonly isFromSelf; private readonly onMessage; private channels; private client?; private reconnectTimer?; private readonly cleanupTimer?; constructor(pool: Pool, opts: Required<PostgresAdapterOptions>, isFromSelf: (msg: ExtendedClusterMessage) => boolean, onMessage: (msg: ClusterMessage) => void); private scheduleReconnection; private initClient; addNamespace(namespace: string): void; publish(message: ClusterMessage | ClusterResponse): Promise<void>; private publishWithAttachment; close(): void; }