(msg: { type: WebsocketMessageType; payload?: any })
| 121 | } |
| 122 | |
| 123 | onMessage(msg: { type: WebsocketMessageType; payload?: any }) { |
| 124 | switch (msg.type) { |
| 125 | case "flows/add": |
| 126 | return this.queueOrDispatch( |
| 127 | Resource.Flows, |
| 128 | FLOWS_ADD(msg.payload), |
| 129 | ); |
| 130 | case "flows/update": |
| 131 | return this.queueOrDispatch( |
| 132 | Resource.Flows, |
| 133 | FLOWS_UPDATE(msg.payload), |
| 134 | ); |
| 135 | case "flows/filterUpdate": |
| 136 | return this.queueOrDispatch( |
| 137 | Resource.Flows, |
| 138 | FLOWS_FILTER_UPDATE(msg.payload), |
| 139 | ); |
| 140 | case "flows/remove": |
| 141 | return this.queueOrDispatch( |
| 142 | Resource.Flows, |
| 143 | FLOWS_REMOVE(msg.payload), |
| 144 | ); |
| 145 | case "events/add": |
| 146 | return this.queueOrDispatch( |
| 147 | Resource.Events, |
| 148 | EVENTS_ADD(msg.payload), |
| 149 | ); |
| 150 | case "options/update": |
| 151 | return this.queueOrDispatch( |
| 152 | Resource.Options, |
| 153 | OPTIONS_UPDATE(msg.payload), |
| 154 | ); |
| 155 | case "state/update": |
| 156 | return this.queueOrDispatch( |
| 157 | Resource.State, |
| 158 | STATE_UPDATE(msg.payload), |
| 159 | ); |
| 160 | case "flows/reset": |
| 161 | return this.fetchData(Resource.Flows); |
| 162 | case "events/reset": |
| 163 | return this.fetchData(Resource.Events); |
| 164 | /* istanbul ignore next @preserve */ |
| 165 | default: |
| 166 | assertNever(msg.type); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | sendMessage(action: PayloadAction<any>) { |
| 171 | if (this.socket.readyState === WebSocket.OPEN) { |
no test coverage detected