(method: string, params?: any)
| 472 | public nextId = 0; |
| 473 | |
| 474 | public callMethod(method: string, params?: any): Promise<DebuggerResult> { |
| 475 | const id = `${this.nextId++}`; |
| 476 | const completer = new PromiseCompleter<DebuggerResult>(); |
| 477 | this.completers[id] = completer; |
| 478 | |
| 479 | const json = { |
| 480 | id, |
| 481 | jsonrpc: "2.0", |
| 482 | method, |
| 483 | params: params || {}, |
| 484 | }; |
| 485 | const str = JSON.stringify(json); |
| 486 | this.logTraffic(`==> ${str}\n`); |
| 487 | this.socket.send(str); |
| 488 | |
| 489 | return completer.promise; |
| 490 | } |
| 491 | |
| 492 | public handleData(data: string) { |
| 493 | this.logTraffic(`<== ${data}\n`); |
no test coverage detected