| 63 | * The Reactotron server. |
| 64 | */ |
| 65 | export default class Server { |
| 66 | /** |
| 67 | * An event emitter which fires events from connected clients. |
| 68 | */ |
| 69 | emitter = mitt<ServerEventMap>() |
| 70 | |
| 71 | /** |
| 72 | * Additional server configuration. |
| 73 | */ |
| 74 | options: ServerOptions = mergeRight({}, DEFAULTS) |
| 75 | |
| 76 | /** |
| 77 | * A unique id which is assigned to each inbound message. |
| 78 | */ |
| 79 | messageId = 0 |
| 80 | |
| 81 | /** |
| 82 | * A unique id which is assigned to each inbound connection. |
| 83 | */ |
| 84 | connectionId = 0 |
| 85 | |
| 86 | /** |
| 87 | * Which redux state locations we are subscribing to. |
| 88 | */ |
| 89 | subscriptions: string[] = [] |
| 90 | |
| 91 | /** |
| 92 | * Registered custom commands per clientId. |
| 93 | */ |
| 94 | customCommands: Map< |
| 95 | string, |
| 96 | { id: number; command: string; title?: string; description?: string; args?: any[] }[] |
| 97 | > = new Map() |
| 98 | |
| 99 | /** |
| 100 | * Clients who are in the process of connecting but haven't yet handshaked. |
| 101 | */ |
| 102 | partialConnections: PartialConnection[] = [] |
| 103 | |
| 104 | /** |
| 105 | * The web socket. |
| 106 | */ |
| 107 | wss: WebSocketServer |
| 108 | |
| 109 | /** |
| 110 | * Holds the currently connected clients. |
| 111 | */ |
| 112 | connections = [] |
| 113 | |
| 114 | /** |
| 115 | * Have we started the server? |
| 116 | */ |
| 117 | started = false |
| 118 | |
| 119 | /** |
| 120 | * Keep alive interval to be running while the server is up. |
| 121 | */ |
| 122 | keepAlive: ReturnType<typeof setInterval> |
nothing calls this directly
no test coverage detected