Add debug-dump-ws command

Add debug command to dump the WebSocket messages being sent and received
by the master server to aid in finding chatty events.
This commit is contained in:
Hornwitser committed 2020-04-09 19:50:01 +02:00
1 parent 61d92a6910
commit 2c855a5846
4 files changed
+56 -1

No files matched your search

+12
View File
@@ -310,6 +310,14 @@ commands.push(new Command({
},
}));
commands.push(new Command({
definition: ["debug-dump-ws", "Dump WebSocket messages sent and received by master", (yargs) => { }],
handler: async function(args, control) {
await link.messages.debugDumpWs.send(control);
return new Promise(() => {});
},
}));
// Convert to mapping from name to command instance
commands = new Map([...commands.map(command => [command.name, command])]);
@@ -352,6 +360,10 @@ class Control extends link.Link {
console.log(formatOutputColored(output));
}
async debugWsMessageEventHandler(message) {
console.log("WS", message.data.direction, message.data.content);
}
async shutdown() {
this.connector.setTimeout(30);