upgrading react-dev-tools

Summary:
Updating react-devtools plugin to the latest version.

As Flipper doesn't use a websocket anymore, this plugin was not working. In this diff, we are creating a websocket connection parallel to the rSocket connection which is used by the devtools. First we thought about tunneling the websocket through our rSocket, but this would be a lot more work.

By default they create a web-socket running on port 8097. But if this port is in use another port is used. The hostname and port to connect to is sent to the client-plugin.

Reviewed By: jknoxville

Differential Revision: D12897150

fbshipit-source-id: 6652b3c91fd5bd87fe86b29c730c8b2076bbc6ba
This commit is contained in:
Daniel Büchele
2018-12-04 03:35:43 -08:00
committed by Facebook Github Bot
parent a656c31a70
commit 5a9d92c786
3 changed files with 80 additions and 2 deletions

View File

@@ -6,13 +6,12 @@
*/
import type {FlipperPlugin, FlipperBasePlugin} from './plugin.js';
import {FlipperDevicePlugin} from './plugin.js';
import type BaseDevice from './devices/BaseDevice.js';
import type {App} from './App.js';
import type Logger from './fb-stubs/Logger.js';
import type {Store} from './reducers/index.js';
import {FlipperDevicePlugin} from './plugin.js';
import {setPluginState} from './reducers/pluginStates.js';
import {ReactiveSocket, PartialResponder} from 'rsocket-core';
@@ -122,6 +121,13 @@ export default class Client extends EventEmitter {
this.emit('plugins-change');
}
getDevice = (): ?BaseDevice =>
this.store
.getState()
.connections.devices.find(
(device: BaseDevice) => device.serial === this.query.device_id,
);
onMessage(msg: string) {
if (typeof msg !== 'string') {
return;