Make sure devices and clients are registered on session startup
Summary: This diff makes sure that when the client starts, it fetches all known devices and clients first, as it might have missed the 'connect' events for those. For Electron this wasn't needed, since the server starts with the UI, but this makes sure that a browser reload or a second connection sees the same devices & apps Reviewed By: aigoncharov Differential Revision: D32881589 fbshipit-source-id: 7b1cb3d296044f83dedcf3f3d8d02864690b6666
This commit is contained in:
committed by
Facebook GitHub Bot
parent
943d535e86
commit
3c6668a8b9
@@ -214,6 +214,9 @@ export class FlipperServerImpl implements FlipperServer {
|
||||
private commandHandler: FlipperServerCommands = {
|
||||
'get-config': async () => this.config,
|
||||
'get-changelog': getChangelog,
|
||||
'device-list': async () => {
|
||||
return Array.from(this.devices.values()).map((d) => d.info);
|
||||
},
|
||||
'device-start-logging': async (serial: string) =>
|
||||
this.getDevice(serial).startLogging(),
|
||||
'device-stop-logging': async (serial: string) =>
|
||||
@@ -242,6 +245,9 @@ export class FlipperServerImpl implements FlipperServer {
|
||||
}
|
||||
device.sendCommand(command);
|
||||
},
|
||||
'client-list': async () => {
|
||||
return Array.from(this.server.connections.values()).map((c) => c.client);
|
||||
},
|
||||
'client-request': async (clientId, payload) => {
|
||||
this.server.connections.get(clientId)?.connection?.send(payload);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user