@muspellheim/shared 0.17.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mod.cjs +556 -0
- package/dist/mod.js +524 -0
- package/dist/types/common/clock.d.ts +40 -0
- package/dist/types/common/event_tracker.d.ts +44 -0
- package/dist/types/common/log.d.ts +17 -0
- package/{src/common/mod.ts → dist/types/common/mod.d.ts} +0 -2
- package/{src/domain/messages.ts → dist/types/domain/messages.d.ts} +13 -24
- package/dist/types/domain/mod.d.ts +1 -0
- package/dist/types/infrastructure/configurable_responses.d.ts +58 -0
- package/dist/types/infrastructure/console_log.d.ts +34 -0
- package/dist/types/infrastructure/fetch_stub.d.ts +20 -0
- package/dist/types/infrastructure/message_client.d.ts +44 -0
- package/{src/infrastructure/mod.ts → dist/types/infrastructure/mod.d.ts} +0 -2
- package/dist/types/infrastructure/output_tracker.d.ts +60 -0
- package/dist/types/infrastructure/sse_client.d.ts +37 -0
- package/dist/types/infrastructure/web_socket_client.d.ts +79 -0
- package/{src/mod.ts → dist/types/mod.d.ts} +0 -2
- package/package.json +14 -23
- package/dist/shared.d.ts +0 -494
- package/dist/shared.js +0 -670
- package/dist/shared.js.map +0 -1
- package/dist/shared.umd.cjs +0 -2
- package/dist/shared.umd.cjs.map +0 -1
- package/src/common/clock.ts +0 -60
- package/src/common/event_tracker.ts +0 -94
- package/src/common/log.ts +0 -27
- package/src/domain/mod.ts +0 -3
- package/src/infrastructure/configurable_responses.ts +0 -90
- package/src/infrastructure/console_log.ts +0 -160
- package/src/infrastructure/fetch_stub.ts +0 -89
- package/src/infrastructure/message_client.ts +0 -50
- package/src/infrastructure/output_tracker.ts +0 -89
- package/src/infrastructure/sse_client.ts +0 -162
- package/src/infrastructure/web_socket_client.ts +0 -279
- package/src/vite-env.d.ts +0 -3
package/dist/shared.d.ts
DELETED
|
@@ -1,494 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A clock provides access to the current timestamp.
|
|
3
|
-
*/
|
|
4
|
-
export declare class Clock {
|
|
5
|
-
#private;
|
|
6
|
-
/**
|
|
7
|
-
* Create a clock using system the clock.
|
|
8
|
-
*
|
|
9
|
-
* @return A clock that uses the system clock.
|
|
10
|
-
*/
|
|
11
|
-
static system(): Clock;
|
|
12
|
-
/**
|
|
13
|
-
* Create a clock using a fixed date.
|
|
14
|
-
*
|
|
15
|
-
* @param date The fixed date of the clock.
|
|
16
|
-
* @return A clock that always returns a fixed date.
|
|
17
|
-
*/
|
|
18
|
-
static fixed(date: Date | string | number): Clock;
|
|
19
|
-
/**
|
|
20
|
-
* Create a clock that returns a fixed offset from the given clock.
|
|
21
|
-
*
|
|
22
|
-
* @param clock The clock to offset from.
|
|
23
|
-
* @param offsetMillis The offset in milliseconds.
|
|
24
|
-
* @return A clock that returns a fixed offset from the given clock.
|
|
25
|
-
*/
|
|
26
|
-
static offset(clock: Clock, offsetMillis: number): Clock;
|
|
27
|
-
private constructor();
|
|
28
|
-
/**
|
|
29
|
-
* Return the current timestamp of the clock.
|
|
30
|
-
*
|
|
31
|
-
* @return The current timestamp.
|
|
32
|
-
*/
|
|
33
|
-
date(): Date;
|
|
34
|
-
/**
|
|
35
|
-
* Return the current timestamp of the clock in milliseconds.
|
|
36
|
-
*
|
|
37
|
-
* @return The current timestamp in milliseconds.
|
|
38
|
-
*/
|
|
39
|
-
millis(): number;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Provides CQNS features.
|
|
44
|
-
*
|
|
45
|
-
* The Command Query Notification Separation principle is a software design
|
|
46
|
-
* principle that separates the concerns of commands, queries, and
|
|
47
|
-
* notifications.
|
|
48
|
-
*
|
|
49
|
-
* Message hierarchy:
|
|
50
|
-
*
|
|
51
|
-
* - Message
|
|
52
|
-
* - Incoming / outgoing
|
|
53
|
-
* - Request (outgoing) -> response (incoming)
|
|
54
|
-
* - Command -> command status
|
|
55
|
-
* - Query -> query result
|
|
56
|
-
* - Notification
|
|
57
|
-
* - Incoming: notification -> commands
|
|
58
|
-
* - Outgoing
|
|
59
|
-
* - Event (internal)
|
|
60
|
-
*
|
|
61
|
-
* @see https://ralfw.de/command-query-notification-separation-cqns/
|
|
62
|
-
* @module
|
|
63
|
-
*/
|
|
64
|
-
/**
|
|
65
|
-
* The status returned by a command handler.
|
|
66
|
-
*/
|
|
67
|
-
export declare type CommandStatus = Success | Failure;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Handle returning pre-configured responses.
|
|
71
|
-
*
|
|
72
|
-
* This is one of the nullability patterns from James Shore's article on
|
|
73
|
-
* [testing without mocks](https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#configurable-responses).
|
|
74
|
-
*
|
|
75
|
-
* Example usage for stubbing `fetch` function:
|
|
76
|
-
*
|
|
77
|
-
* ```javascript
|
|
78
|
-
* function createFetchStub(responses) {
|
|
79
|
-
* const configurableResponses = ConfigurableResponses.create(responses);
|
|
80
|
-
* return async function () {
|
|
81
|
-
* const response = configurableResponses.next();
|
|
82
|
-
* return {
|
|
83
|
-
* status: response.status,
|
|
84
|
-
* json: async () => response.body,
|
|
85
|
-
* };
|
|
86
|
-
* };
|
|
87
|
-
* }
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
export declare class ConfigurableResponses<T = unknown> {
|
|
91
|
-
#private;
|
|
92
|
-
/**
|
|
93
|
-
* Create a list of responses (by providing an array), or a single repeating
|
|
94
|
-
* response (by providing any other type). 'Name' is optional and used in
|
|
95
|
-
* error messages.
|
|
96
|
-
*
|
|
97
|
-
* @param responses A single response or an array of responses.
|
|
98
|
-
* @param name An optional name for the responses.
|
|
99
|
-
*/
|
|
100
|
-
static create<T>(responses?: T | T[], name?: string): ConfigurableResponses<T>;
|
|
101
|
-
/**
|
|
102
|
-
* Convert all properties in an object into ConfigurableResponse instances.
|
|
103
|
-
* For example, { a: 1 } becomes { a: ConfigurableResponses.create(1) }.
|
|
104
|
-
* 'Name' is optional and used in error messages.
|
|
105
|
-
*
|
|
106
|
-
* @param responseObject An object with single response or an array of responses.
|
|
107
|
-
* @param name An optional name for the responses.
|
|
108
|
-
*/
|
|
109
|
-
static mapObject<T extends Record<string, unknown>>(responseObject: T, name?: string): any;
|
|
110
|
-
/**
|
|
111
|
-
* Create a list of responses (by providing an array), or a single repeating
|
|
112
|
-
* response (by providing any other type). 'Name' is optional and used in
|
|
113
|
-
* error messages.
|
|
114
|
-
*
|
|
115
|
-
* @param responses A single response or an array of responses.
|
|
116
|
-
* @param name An optional name for the responses.
|
|
117
|
-
*/
|
|
118
|
-
constructor(responses?: T | T[], name?: string);
|
|
119
|
-
/**
|
|
120
|
-
* Get the next configured response. Throws an error when configured with a list
|
|
121
|
-
* of responses and no more responses remain.
|
|
122
|
-
*
|
|
123
|
-
* @return The next response.
|
|
124
|
-
*/
|
|
125
|
-
next(): T;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Wraps the console interface and allow setting the log level.
|
|
130
|
-
*
|
|
131
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Console_API
|
|
132
|
-
*/
|
|
133
|
-
export declare class ConsoleLog extends EventTarget implements Log {
|
|
134
|
-
#private;
|
|
135
|
-
static create({ name }?: {
|
|
136
|
-
name?: string;
|
|
137
|
-
}): ConsoleLog;
|
|
138
|
-
static createNull({ name }?: {
|
|
139
|
-
name?: string;
|
|
140
|
-
}): ConsoleLog;
|
|
141
|
-
name?: string;
|
|
142
|
-
level: LogLevel;
|
|
143
|
-
private constructor();
|
|
144
|
-
log(...data: unknown[]): void;
|
|
145
|
-
error(...data: unknown[]): void;
|
|
146
|
-
warn(...data: unknown[]): void;
|
|
147
|
-
info(...data: unknown[]): void;
|
|
148
|
-
debug(...data: unknown[]): void;
|
|
149
|
-
trace(...data: unknown[]): void;
|
|
150
|
-
/**
|
|
151
|
-
* Track the console messages.
|
|
152
|
-
*/
|
|
153
|
-
trackMessages(): OutputTracker<ConsoleMessage>;
|
|
154
|
-
isLoggable(level: LogLevel): boolean;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export declare interface ConsoleMessage {
|
|
158
|
-
level: LogLevel;
|
|
159
|
-
message: unknown[];
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Create a fetch stub.
|
|
164
|
-
*
|
|
165
|
-
* The stub returns a response from the provided response data or throws an provided error.
|
|
166
|
-
*
|
|
167
|
-
* @param responses A single response or an array of responses.
|
|
168
|
-
* @returns The fetch stub.
|
|
169
|
-
*/
|
|
170
|
-
export declare function createFetchStub(responses?: ResponseData | Error | (ResponseData | Error)[]): () => Promise<Response>;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Track events from an event target.
|
|
174
|
-
*
|
|
175
|
-
* Wait asynchronously for events. Useful in test code.
|
|
176
|
-
*/
|
|
177
|
-
export declare class EventTracker<T extends Event> {
|
|
178
|
-
#private;
|
|
179
|
-
/**
|
|
180
|
-
* Create a tracker for a specific event of an event target.
|
|
181
|
-
*
|
|
182
|
-
* @param eventTarget The target to track.
|
|
183
|
-
* @param event The event name to track.
|
|
184
|
-
*/
|
|
185
|
-
static create<T extends Event>(eventTarget: EventTarget, ...event: string[]): EventTracker<T>;
|
|
186
|
-
/**
|
|
187
|
-
* Create a tracker for a specific event of an event target.
|
|
188
|
-
*
|
|
189
|
-
* @param eventTarget The target to track.
|
|
190
|
-
* @param event The event name to track.
|
|
191
|
-
*/
|
|
192
|
-
constructor(eventTarget: EventTarget, event: string[]);
|
|
193
|
-
/**
|
|
194
|
-
* Return the tracked events.
|
|
195
|
-
*
|
|
196
|
-
* @return The tracked events.
|
|
197
|
-
*/
|
|
198
|
-
get events(): T[];
|
|
199
|
-
/**
|
|
200
|
-
* Clear the tracked events and return the cleared events.
|
|
201
|
-
*
|
|
202
|
-
* @return The cleared events.
|
|
203
|
-
*/
|
|
204
|
-
clear(): T[];
|
|
205
|
-
/**
|
|
206
|
-
* Stop tracking.
|
|
207
|
-
*/
|
|
208
|
-
stop(): void;
|
|
209
|
-
/**
|
|
210
|
-
* Wait asynchronously for a number of events.
|
|
211
|
-
*
|
|
212
|
-
* @param count number of events, default 1.
|
|
213
|
-
*/
|
|
214
|
-
waitFor(count?: number): Promise<T[]>;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* A failed status.
|
|
219
|
-
*/
|
|
220
|
-
export declare class Failure<T = string> {
|
|
221
|
-
readonly isSuccess = false;
|
|
222
|
-
readonly errorMessage: T;
|
|
223
|
-
/**
|
|
224
|
-
* Creates a failed status.
|
|
225
|
-
*
|
|
226
|
-
* @param errorMessage
|
|
227
|
-
*/
|
|
228
|
-
constructor(errorMessage: T);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export declare const HEARTBEAT_TYPE = "heartbeat";
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* A simple logging facade.
|
|
235
|
-
*
|
|
236
|
-
* This is a subset of the `Console` interface.
|
|
237
|
-
*
|
|
238
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Console_API
|
|
239
|
-
*/
|
|
240
|
-
export declare interface Log {
|
|
241
|
-
log(...data: unknown[]): void;
|
|
242
|
-
error(...data: unknown[]): void;
|
|
243
|
-
warn(...data: unknown[]): void;
|
|
244
|
-
info(...data: unknown[]): void;
|
|
245
|
-
debug(...data: unknown[]): void;
|
|
246
|
-
trace(...data: unknown[]): void;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/** Defines level for setting a log level in a `Log` implementation. */
|
|
250
|
-
export declare type LogLevel = "log" | "error" | "warn" | "info" | "debug" | "trace" | "off";
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* An interface for a streaming message client.
|
|
254
|
-
*
|
|
255
|
-
* Emits the following events:
|
|
256
|
-
*
|
|
257
|
-
* - open, {@link Event}
|
|
258
|
-
* - message, {@link MessageEvent}
|
|
259
|
-
* - error, {@link Event}
|
|
260
|
-
* - close, optional {@link CloseEvent}
|
|
261
|
-
*
|
|
262
|
-
* It is used for wrappers around {@link EventSource} and {@link WebSocket}.
|
|
263
|
-
*
|
|
264
|
-
* @see {@link SseClient}
|
|
265
|
-
* @see {@link WebSocketClient}
|
|
266
|
-
*/
|
|
267
|
-
export declare interface MessageClient extends EventTarget {
|
|
268
|
-
/**
|
|
269
|
-
* Return whether the client is connected.
|
|
270
|
-
*/
|
|
271
|
-
get isConnected(): boolean;
|
|
272
|
-
/**
|
|
273
|
-
* Return the server URL.
|
|
274
|
-
*/
|
|
275
|
-
get url(): string | undefined;
|
|
276
|
-
/**
|
|
277
|
-
* Connect to the server.
|
|
278
|
-
*
|
|
279
|
-
* @param url The server URL to connect to.
|
|
280
|
-
*/
|
|
281
|
-
connect(url: string | URL): Promise<void>;
|
|
282
|
-
/**
|
|
283
|
-
* Send a message to the server.
|
|
284
|
-
*
|
|
285
|
-
* This is an optional method for streams with bidirectional communication.
|
|
286
|
-
*
|
|
287
|
-
* @param message The message to send.
|
|
288
|
-
* @param type The optional message type.
|
|
289
|
-
*/
|
|
290
|
-
send(message: string, type?: string): Promise<void>;
|
|
291
|
-
/**
|
|
292
|
-
* Close the connection.
|
|
293
|
-
*/
|
|
294
|
-
close(): Promise<void>;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Track output events.
|
|
299
|
-
*
|
|
300
|
-
* This is one of the nullability patterns from James Shore's article on
|
|
301
|
-
* [testing without mocks](https://www.jamesshore.com/v2/projects/nullables/testing-without-mocks#output-tracking).
|
|
302
|
-
*
|
|
303
|
-
* Example implementation of an event store:
|
|
304
|
-
*
|
|
305
|
-
* ```javascript
|
|
306
|
-
* async record(event) {
|
|
307
|
-
* // ...
|
|
308
|
-
* this.dispatchEvent(new CustomEvent("eventRecorded", { detail: event }));
|
|
309
|
-
* }
|
|
310
|
-
*
|
|
311
|
-
* trackEventsRecorded() {
|
|
312
|
-
* return new OutputTracker(this, "eventRecorded");
|
|
313
|
-
* }
|
|
314
|
-
* ```
|
|
315
|
-
*
|
|
316
|
-
* Example usage:
|
|
317
|
-
*
|
|
318
|
-
* ```javascript
|
|
319
|
-
* const eventsRecorded = eventStore.trackEventsRecorded();
|
|
320
|
-
* // ...
|
|
321
|
-
* const data = eventsRecorded.data(); // [event1, event2, ...]
|
|
322
|
-
* ```
|
|
323
|
-
*/
|
|
324
|
-
export declare class OutputTracker<T = unknown> {
|
|
325
|
-
#private;
|
|
326
|
-
/**
|
|
327
|
-
* Create a tracker for a specific event of an event target.
|
|
328
|
-
*
|
|
329
|
-
* @param eventTarget The target to track.
|
|
330
|
-
* @param event The event name to track.
|
|
331
|
-
*/
|
|
332
|
-
static create<T>(eventTarget: EventTarget, event: string): OutputTracker<T>;
|
|
333
|
-
/**
|
|
334
|
-
* Create a tracker for a specific event of an event target.
|
|
335
|
-
*
|
|
336
|
-
* @param eventTarget The target to track.
|
|
337
|
-
* @param event The event name to track.
|
|
338
|
-
*/
|
|
339
|
-
constructor(eventTarget: EventTarget, event: string);
|
|
340
|
-
/**
|
|
341
|
-
* Return the tracked data.
|
|
342
|
-
*
|
|
343
|
-
* @return The tracked data.
|
|
344
|
-
*/
|
|
345
|
-
get data(): T[];
|
|
346
|
-
/**
|
|
347
|
-
* Clear the tracked data and return the cleared data.
|
|
348
|
-
*
|
|
349
|
-
* @return The cleared data.
|
|
350
|
-
*/
|
|
351
|
-
clear(): T[];
|
|
352
|
-
/**
|
|
353
|
-
* Stop tracking.
|
|
354
|
-
*/
|
|
355
|
-
stop(): void;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* This data object configures the response of a fetch stub call.
|
|
360
|
-
*/
|
|
361
|
-
export declare interface ResponseData {
|
|
362
|
-
/** The HTTP status code. */
|
|
363
|
-
status: number;
|
|
364
|
-
/** The HTTP status text. */
|
|
365
|
-
statusText: string;
|
|
366
|
-
/** The optional response body. */
|
|
367
|
-
body?: Blob | object | string | null;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* A client for the server-sent events protocol.
|
|
372
|
-
*/
|
|
373
|
-
export declare class SseClient extends EventTarget implements MessageClient {
|
|
374
|
-
#private;
|
|
375
|
-
/**
|
|
376
|
-
* Create an SSE client.
|
|
377
|
-
*
|
|
378
|
-
* @return A new SSE client.
|
|
379
|
-
*/
|
|
380
|
-
static create(): SseClient;
|
|
381
|
-
/**
|
|
382
|
-
* Create a nulled SSE client.
|
|
383
|
-
*
|
|
384
|
-
* @return A new SSE client.
|
|
385
|
-
*/
|
|
386
|
-
static createNull(): SseClient;
|
|
387
|
-
private constructor();
|
|
388
|
-
get isConnected(): boolean;
|
|
389
|
-
get url(): string | undefined;
|
|
390
|
-
connect(url: string | URL, eventName?: string, ...otherEvents: string[]): Promise<void>;
|
|
391
|
-
send(_message: string, _type?: string): Promise<void>;
|
|
392
|
-
close(): Promise<void>;
|
|
393
|
-
/**
|
|
394
|
-
* Simulate a message event from the server.
|
|
395
|
-
*
|
|
396
|
-
* @param message The message to receive.
|
|
397
|
-
* @param eventName The optional event type.
|
|
398
|
-
* @param lastEventId The optional last event ID.
|
|
399
|
-
*/
|
|
400
|
-
simulateMessage(message: string | number | boolean | object | null, eventName?: string, lastEventId?: string): void;
|
|
401
|
-
/**
|
|
402
|
-
* Simulate an error event.
|
|
403
|
-
*/
|
|
404
|
-
simulateError(): void;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* A successful status.
|
|
409
|
-
*/
|
|
410
|
-
export declare class Success<T = unknown> {
|
|
411
|
-
readonly isSuccess = true;
|
|
412
|
-
readonly result?: T;
|
|
413
|
-
constructor(result?: T);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* A client for the WebSocket protocol.
|
|
418
|
-
*/
|
|
419
|
-
export declare class WebSocketClient extends EventTarget implements MessageClient {
|
|
420
|
-
#private;
|
|
421
|
-
/**
|
|
422
|
-
* Create a WebSocket client.
|
|
423
|
-
*
|
|
424
|
-
* @param options The options for the WebSocket client.
|
|
425
|
-
* @return A new WebSocket client.
|
|
426
|
-
*/
|
|
427
|
-
static create({ heartbeat, retry, }?: WebSocketOptions): WebSocketClient;
|
|
428
|
-
/**
|
|
429
|
-
* Create a nulled WebSocket client.
|
|
430
|
-
*
|
|
431
|
-
* @param options The options for the WebSocket client.
|
|
432
|
-
* @return A new nulled WebSocket client.
|
|
433
|
-
*/
|
|
434
|
-
static createNull({ heartbeat, retry }?: WebSocketOptions): WebSocketClient;
|
|
435
|
-
private constructor();
|
|
436
|
-
get isConnected(): boolean;
|
|
437
|
-
get url(): string | undefined;
|
|
438
|
-
connect(url: string | URL): Promise<void>;
|
|
439
|
-
send(message: string | ArrayBuffer | Blob | ArrayBufferView): Promise<void>;
|
|
440
|
-
/**
|
|
441
|
-
* Return a tracker for messages sent.
|
|
442
|
-
*
|
|
443
|
-
* @return A new output tracker.
|
|
444
|
-
*/
|
|
445
|
-
trackMessageSent(): OutputTracker<string>;
|
|
446
|
-
/**
|
|
447
|
-
* Close the connection.
|
|
448
|
-
*
|
|
449
|
-
* If a code is provided, also a reason should be provided.
|
|
450
|
-
*
|
|
451
|
-
* @param code An optional code.
|
|
452
|
-
* @param reason An optional reason.
|
|
453
|
-
*/
|
|
454
|
-
close(code?: number, reason?: string): Promise<void>;
|
|
455
|
-
/**
|
|
456
|
-
* Simulate a message event from the server.
|
|
457
|
-
*
|
|
458
|
-
* @param message The message to receive.
|
|
459
|
-
*/
|
|
460
|
-
simulateMessage(message: string | number | boolean | object | null | Blob | ArrayBuffer): void;
|
|
461
|
-
/**
|
|
462
|
-
* Simulate a heartbeat.
|
|
463
|
-
*/
|
|
464
|
-
simulateHeartbeat(): void;
|
|
465
|
-
/**
|
|
466
|
-
* Simulate a close event.
|
|
467
|
-
*
|
|
468
|
-
* @param code An optional code.
|
|
469
|
-
* @param reason An optional reason.
|
|
470
|
-
*/
|
|
471
|
-
simulateClose(code?: number, reason?: string): void;
|
|
472
|
-
/**
|
|
473
|
-
* Simulate an error event.
|
|
474
|
-
*/
|
|
475
|
-
simulateError(): void;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Options for the WebSocket client.
|
|
480
|
-
*/
|
|
481
|
-
export declare interface WebSocketOptions {
|
|
482
|
-
/**
|
|
483
|
-
* The heartbeat interval in milliseconds. A value <= 0 disables the
|
|
484
|
-
* heartbeat.
|
|
485
|
-
*/
|
|
486
|
-
heartbeat?: number;
|
|
487
|
-
/**
|
|
488
|
-
* The time in milliseconds to wait before retrying a connection after an
|
|
489
|
-
* error. A value <= 0 disables automatic retries.
|
|
490
|
-
*/
|
|
491
|
-
retry?: number;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
export { }
|