(request: MonitoringRequest)
| 89 | | Request; |
| 90 | |
| 91 | function monitoring(request: MonitoringRequest) { |
| 92 | if (request.type === 'DISCONNECTED') { |
| 93 | store.dispatch({ |
| 94 | type: REMOVE_INSTANCE, |
| 95 | id: request.id, |
| 96 | }); |
| 97 | return; |
| 98 | } |
| 99 | if (request.type === 'START') { |
| 100 | store.dispatch({ type: actions.EMIT, message: 'START', id: request.id }); |
| 101 | return; |
| 102 | } |
| 103 | |
| 104 | if (request.type === 'ERROR') { |
| 105 | store.dispatch(showNotification(request.payload)); |
| 106 | return; |
| 107 | } |
| 108 | |
| 109 | store.dispatch({ |
| 110 | type: UPDATE_STATE, |
| 111 | request: (request as unknown as RequestWithData).data |
| 112 | ? { ...(request as unknown as RequestWithData).data, id: request.id } |
| 113 | : request, |
| 114 | }); |
| 115 | |
| 116 | const instances = store.getState().instances; |
| 117 | const instanceId = request.instanceId || request.id; |
| 118 | if ( |
| 119 | instances.sync && |
| 120 | instanceId === instances.selected && |
| 121 | (request.type === 'ACTION' || request.type === 'STATE') |
| 122 | ) { |
| 123 | socket.emit('respond', { |
| 124 | type: 'SYNC', |
| 125 | state: stringify(instances.states[instanceId]), |
| 126 | id: request.id, |
| 127 | instanceId, |
| 128 | }); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | function subscribe( |
| 133 | channelName: string, |
nothing calls this directly
no test coverage detected