diff --git a/testSupport/README.md b/testSupport/README.md index 8eae9e1..1c5d92e 100644 --- a/testSupport/README.md +++ b/testSupport/README.md @@ -14,6 +14,8 @@ var dc: DebugClient; setup( () => { dc = new DebugClient('node', './out/node/nodeDebug.js', 'node'); + dc.on("send", (body: string) => console.log("send>>> " + body)) + dc.on("recv", (body: string) => console.log("recv<<< " + body)) return dc.start(); }); diff --git a/testSupport/src/protocolClient.ts b/testSupport/src/protocolClient.ts index 50894d1..7f92d1a 100644 --- a/testSupport/src/protocolClient.ts +++ b/testSupport/src/protocolClient.ts @@ -94,6 +94,7 @@ export class ProtocolClient extends ee.EventEmitter { this.pendingRequests.set(request.seq, clb); const json = JSON.stringify(request); + this.emit("send", json); this.outputStream.write(`Content-Length: ${Buffer.byteLength(json, 'utf8')}\r\n\r\n${json}`, 'utf8'); } @@ -132,7 +133,7 @@ export class ProtocolClient extends ee.EventEmitter { } private dispatch(body: string): void { - + this.emit("recv", body); const rawData = JSON.parse(body); if (typeof rawData.event !== 'undefined') {