1 | import type { LifeCycleMethods, PluginCreator } from "./reactotron-core-client";
|
2 | import NodeWebSocket from "ws";
|
3 | type BrowserWebSocket = WebSocket;
|
4 |
|
5 |
|
6 |
|
7 | export interface ClientOptions<Client> extends Omit<LifeCycleMethods, "onCommand"> {
|
8 | |
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | createSocket?: ((path: string) => BrowserWebSocket) | ((path: string) => NodeWebSocket) | null;
|
15 | /**
|
16 | * The hostname or ip address of the server. Default: localhost.
|
17 | */
|
18 | host?: string | null;
|
19 | /**
|
20 | * The port to connect to the server on. Default: 9090.
|
21 | */
|
22 | port?: number | null;
|
23 | /**
|
24 | * The name of this client. Usually the app name.
|
25 | */
|
26 | name?: string;
|
27 | /**
|
28 | * Will we be connecting via SSL?
|
29 | */
|
30 | secure?: boolean;
|
31 | /**
|
32 | * A list of plugins.
|
33 | */
|
34 | plugins?: PluginCreator<Client>[];
|
35 | /**
|
36 | * Performs safety checks when serializing. Default: true.
|
37 | *
|
38 | * Will do things like:
|
39 | * - remap falsy values to transport-friendly version
|
40 | * - remove any circular dependencies
|
41 | * - remap functions to something that shows their name
|
42 | *
|
43 | * Hooray for JavaScript!
|
44 | */
|
45 | safeRecursion?: boolean;
|
46 | /**
|
47 | * Fires when the server sends a command.
|
48 | */
|
49 | onCommand?: ((command: any) => void) | null;
|
50 | /**
|
51 | * Fires when we connect to the server.
|
52 | */
|
53 | onConnect?: () => void;
|
54 | |
55 |
|
56 |
|
57 | onDisconnect?: () => void;
|
58 | |
59 |
|
60 |
|
61 | environment?: string;
|
62 | |
63 |
|
64 |
|
65 | client?: Record<string, string | number | boolean>;
|
66 | |
67 |
|
68 |
|
69 | setClientId?: (clientId: string) => Promise<void>;
|
70 | |
71 |
|
72 |
|
73 | getClientId?: (name: string) => Promise<string>;
|
74 | proxyHack?: boolean;
|
75 | }
|
76 | export {};
|