* Starts listening for messages on the WebSocket.
()
| 140 | * Starts listening for messages on the WebSocket. |
| 141 | */ |
| 142 | async start(): Promise<void> { |
| 143 | if (this.started) { |
| 144 | throw new Error('Start can only be called once per transport.') |
| 145 | } |
| 146 | await this.opened |
| 147 | if (this.ws.readyState !== WS_OPEN) { |
| 148 | logForDiagnosticsNoPII('error', 'mcp_websocket_start_not_opened') |
| 149 | throw new Error('WebSocket is not open. Cannot start transport.') |
| 150 | } |
| 151 | this.started = true |
| 152 | // Unlike stdio, WebSocket connections are typically already established when the transport is created. |
| 153 | // No explicit connection action needed here, just attaching listeners. |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Closes the WebSocket connection. |
nothing calls this directly
no test coverage detected