()
| 290 | } |
| 291 | |
| 292 | private async connectOnce(): Promise<void> { |
| 293 | await this.transport.connect() |
| 294 | this.disposeMessageListener = this.transport.onMessage((message) => { |
| 295 | if (!isRuntimeNotification(message)) return |
| 296 | for (const listener of this.listeners) listener(message) |
| 297 | }) |
| 298 | await this.requestRaw("initialize", { |
| 299 | clientName: this.options.clientName ?? "Runtime Local Client", |
| 300 | clientPlatform: this.options.clientPlatform ?? "desktop", |
| 301 | ...(this.options.clientVersion ? { clientVersion: this.options.clientVersion } : {}), |
| 302 | protocolVersion: this.options.protocolVersion ?? 1, |
| 303 | }) |
| 304 | this.connected = true |
| 305 | } |
| 306 | |
| 307 | subscribe(listener: NotificationListener): () => void { |
| 308 | this.listeners.add(listener) |
no test coverage detected