CopilotWebSocketForwarder is the default [CopilotWebSocketHandler]: it dials the real upstream and runs a receive loop forwarding upstream→runtime messages. Set OnSendRequestMessage / OnSendResponseMessage to observe, transform, or drop messages in either direction.
| 372 | // messages. Set OnSendRequestMessage / OnSendResponseMessage to observe, |
| 373 | // transform, or drop messages in either direction. |
| 374 | type CopilotWebSocketForwarder struct { |
| 375 | URL string |
| 376 | Headers http.Header |
| 377 | // OnSendRequestMessage observes or transforms each runtime→upstream frame. |
| 378 | // The frame type (text vs binary) is available via the message's Binary |
| 379 | // field and may be changed in the returned message. Return nil to drop the |
| 380 | // frame. |
| 381 | OnSendRequestMessage func(msg CopilotWebSocketMessage) *CopilotWebSocketMessage |
| 382 | // OnSendResponseMessage observes or transforms each upstream→runtime frame. |
| 383 | // The frame type (text vs binary) is available via the message's Binary |
| 384 | // field and may be changed in the returned message. Return nil to drop the |
| 385 | // frame. |
| 386 | OnSendResponseMessage func(msg CopilotWebSocketMessage) *CopilotWebSocketMessage |
| 387 | |
| 388 | conn *websocket.Conn |
| 389 | resp WebSocketResponseWriter |
| 390 | done chan struct{} |
| 391 | err error |
| 392 | closeOnce sync.Once |
| 393 | } |
| 394 | |
| 395 | // NewCopilotWebSocketForwarder creates a forwarding handler targeting |
| 396 | // url with the given handshake headers. |
nothing calls this directly
no outgoing calls
no test coverage detected