Implement subscribing to data updates for Flipper Server Companion
Summary: Allow subscribing to state updates from the plugin in headless mode Reviewed By: passy Differential Revision: D36516754 fbshipit-source-id: 14db51243e1d91332a7327c1792412149339f907
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e40981ee2e
commit
4f9ceb2e22
@@ -7,9 +7,10 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {FlipperCompanionEvents} from './companion-types';
|
||||
import {FlipperServerCommands, FlipperServerEvents} from './server-types';
|
||||
|
||||
type GenericWebSocketMessage<E = string, T = unknown> = {
|
||||
export type GenericWebSocketMessage<E = string, T = unknown> = {
|
||||
event: E;
|
||||
payload: T;
|
||||
};
|
||||
@@ -47,6 +48,16 @@ export type ServerEventWebSocketMessage = GenericWebSocketMessage<
|
||||
}[keyof FlipperServerEvents]
|
||||
>;
|
||||
|
||||
export type CompanionEventWebSocketMessage = GenericWebSocketMessage<
|
||||
'companion-event',
|
||||
{
|
||||
[K in keyof FlipperCompanionEvents]: {
|
||||
event: K;
|
||||
data: FlipperCompanionEvents[K];
|
||||
};
|
||||
}[keyof FlipperCompanionEvents]
|
||||
>;
|
||||
|
||||
export type ClientWebSocketMessage = ExecWebSocketMessage;
|
||||
export type ServerWebSocketMessage =
|
||||
| ExecResponseWebSocketMessage
|
||||
|
||||
Reference in New Issue
Block a user