Modify client id string and device serialisation

Summary:
This improves bug reports.
Adding serial into device.toJson() means you can now easily see which clients (apps) are from which device because they both contain the serial.
Changing client id to use # instead of - because the subcomponents of it already use -.

Reviewed By: passy

Differential Revision: D13058430

fbshipit-source-id: 02697ec623829423e667fd2acbd1abc369a6919b
This commit is contained in:
John Knox
2018-11-14 08:24:25 -08:00
committed by Facebook Github Bot
parent 9f13e1422b
commit a48c680a40
2 changed files with 2 additions and 2 deletions

View File

@@ -66,7 +66,7 @@ export default class BaseDevice {
}
toJSON() {
return `<${this.constructor.name}#${this.title}>`;
return `<${this.constructor.name}#${this.title}#${this.serial}>`;
}
teardown() {}

View File

@@ -253,7 +253,7 @@ export default class Server extends EventEmitter {
addConnection(conn: ReactiveSocket, query: ClientQuery): Client {
invariant(query, 'expected query');
const id = `${query.app}-${query.os}-${query.device}-${query.device_id}`;
const id = `${query.app}#${query.os}#${query.device}#${query.device_id}`;
console.debug(`Device connected: ${id}`, 'server');
const client = new Client(id, query, conn, this.logger, this.store);