UNPKG

991 BTypeScriptView Raw
1/**
2 * @extends Observable<string>
3 */
4export class WebsocketClient extends Observable<string> {
5 /**
6 * @param {string} url
7 * @param {object} [opts]
8 * @param {'arraybuffer' | 'blob' | null} [opts.binaryType] Set `ws.binaryType`
9 */
10 constructor(url: string, { binaryType }?: {
11 binaryType?: "arraybuffer" | "blob" | null | undefined;
12 } | undefined);
13 url: string;
14 /**
15 * @type {WebSocket?}
16 */
17 ws: WebSocket | null;
18 binaryType: "arraybuffer" | "blob" | null;
19 connected: boolean;
20 connecting: boolean;
21 unsuccessfulReconnects: number;
22 lastMessageReceived: number;
23 /**
24 * Whether to connect to other peers or not
25 * @type {boolean}
26 */
27 shouldConnect: boolean;
28 _checkInterval: NodeJS.Timer;
29 /**
30 * @param {any} message
31 */
32 send(message: any): void;
33 disconnect(): void;
34 connect(): void;
35}
36import { Observable } from "./observable.js";
37//# sourceMappingURL=websocket.d.ts.map
\No newline at end of file