Extend Flipper commands to support server add-on messaging

Reviewed By: mweststrate

Differential Revision: D34046466

fbshipit-source-id: 9acc172c1805ec724b8709999bacf9e899c39e6b
This commit is contained in:
Andrey Goncharov
2022-02-28 03:50:34 -08:00
committed by Facebook GitHub Bot
parent 3b390b74ff
commit 12151e4a71
4 changed files with 44 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
*/
import assert from 'assert';
import {ClientResponseType, ExecuteMessage} from 'flipper-common';
import {assertNotNull} from '../comms/Utilities';
type ServerAddOnCleanup = () => Promise<void>;
@@ -20,9 +21,15 @@ const loadPlugin = (_pluginName: string): ServerAddOnModule => {
return {serverAddOn: async () => async () => {}};
};
interface ServerAddOnConnection {
sendExpectResponse(payload: ExecuteMessage): Promise<ClientResponseType>;
}
// TODO: Fix potential race conditions when starting/stopping concurrently
export class ServerAddOn {
private owners: Set<string>;
// TODO: Implement connection
public readonly connection!: ServerAddOnConnection;
constructor(
public readonly pluginName: string,