Summary: Standardize WS implementation for JS environments. Why do we need a separate server implementation for browsers? Browser targets cannot authenticate via the default certificate exchange flow. We need a dedicated client for them that works over an insecure channel (without the cert exchange). Major changes: 1. Renamed `flipper-js-client-sdk` to `js-flipper` for consistency with `react-native-flipper` 2. Updated `js-flipper` implementation to match our other existing clients Documentation will be updated in a separate subsequent PR. https://fb.quip.com/2mboA0xbgoxl Reviewed By: mweststrate Differential Revision: D31688105 fbshipit-source-id: 418aa80e0fd86361c089cf54b0d44a8b4f748efa
37 lines
759 B
TypeScript
37 lines
759 B
TypeScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
export interface FlipperRequest {
|
|
method: string;
|
|
params?: {
|
|
method: string;
|
|
api: string;
|
|
params?: unknown;
|
|
};
|
|
}
|
|
export type FlipperResponse =
|
|
| {
|
|
id: number;
|
|
success: object | string | number | boolean | null;
|
|
error?: never;
|
|
}
|
|
| {
|
|
id: number;
|
|
success?: never;
|
|
error: FlipperErrorMessage;
|
|
};
|
|
export interface FlipperErrorMessage {
|
|
message: string;
|
|
stacktrace?: string;
|
|
name?: string;
|
|
}
|
|
export interface FlipperMessageBus {
|
|
sendData(data: FlipperRequest | FlipperResponse): void;
|
|
}
|