import type { Observable, } from 'rxjs'; import type { ServerOptions, ClientOptions, WebSocketServer, WebSocket } from 'ws'; import type { RxCollection, RxDatabase, RxReplicationHandler, StringKeys } from '../../types/index.d.ts'; export type WebsocketServerOptions = { database: RxDatabase; } & ServerOptions; export type WebsocketServerState = { server: WebSocketServer; close: () => Promise; onConnection$: Observable; }; export type WebsocketClientOptions = { replicationIdentifier: string; collection: RxCollection; url: string; batchSize?: number; live?: boolean; headers?: { [k: string]: string; }; } & ClientOptions; export type WebsocketMessageType = { id: string; collection: string; method: StringKeys> | 'auth'; params: any[]; }; export type WebsocketMessageResponseType = { id: string; collection: string; result: any; };