JS apps support 1/n
Summary: ### Connecting Flipper with JS apps by using electron's BrowserWindow and IPC 1. UI: there is a menu item in Devices tab which opens JS Emulator Launcher Sheet. Here we can configure URL to open and initial size of the window. 2. BrowserWindow, preloaded js: there is SupportJSClientPreload.js which initialize communication between flipper and app via electron's ipc 3. On flipper's side there is src/utils/js-client/serverUtils.tsx which contains most of JS emulator related code 4. Extracting of FlipperClientConnection: since we don't use RScocket to communicate with JS app I extracted needed methods to FlipperClientConnection (located in Client) and partly implemented them in JSClientFlipperConnection (requestResponse is just send a message now, doesn't return actual result) Reviewed By: jknoxville Differential Revision: D18572882 fbshipit-source-id: 56d1ca1a60ed2e51329b917021a09382cbb1ceec
This commit is contained in:
committed by
Facebook Github Bot
parent
e7ad713df8
commit
c685493db0
@@ -16,17 +16,19 @@ import {RSocketServer} from 'rsocket-core';
|
||||
import RSocketTCPServer from 'rsocket-tcp-server';
|
||||
import {Single} from 'rsocket-flowable';
|
||||
import Client from './Client';
|
||||
import {FlipperClientConnection} from './Client';
|
||||
import {UninitializedClient} from './UninitializedClient';
|
||||
import {reportPlatformFailures} from './utils/metrics';
|
||||
import EventEmitter from 'events';
|
||||
import invariant from 'invariant';
|
||||
import tls from 'tls';
|
||||
import net, {Socket} from 'net';
|
||||
import {RSocketClientSocket} from 'rsocket-core/RSocketClient';
|
||||
import {Responder, Payload, ReactiveSocket} from 'rsocket-types';
|
||||
import GK from './fb-stubs/GK';
|
||||
import {initJsEmulatorIPC} from './utils/js-client/serverUtils';
|
||||
|
||||
type ClientInfo = {
|
||||
connection: RSocketClientSocket<any, any> | null | undefined;
|
||||
connection: FlipperClientConnection<any, any> | null | undefined;
|
||||
client: Client;
|
||||
};
|
||||
|
||||
@@ -84,6 +86,11 @@ class Server extends EventEmitter {
|
||||
return;
|
||||
});
|
||||
reportPlatformFailures(this.initialisePromise, 'initializeServer');
|
||||
|
||||
if (GK.get('flipper_js_client_emulator')) {
|
||||
initJsEmulatorIPC(this.store, this.logger, this, this.connections);
|
||||
}
|
||||
|
||||
return this.initialisePromise;
|
||||
}
|
||||
|
||||
@@ -304,7 +311,7 @@ class Server extends EventEmitter {
|
||||
}
|
||||
|
||||
async addConnection(
|
||||
conn: RSocketClientSocket<any, any>,
|
||||
conn: FlipperClientConnection<any, any>,
|
||||
query: ClientQuery,
|
||||
csrQuery: ClientCsrQuery,
|
||||
): Promise<Client> {
|
||||
|
||||
Reference in New Issue
Block a user