UNPKG

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