go-vncproxy icon indicating copy to clipboard operation
go-vncproxy copied to clipboard

Abstract a WebSocket adapter interface to support multiple libraries

Open evangwt opened this issue 4 months ago • 0 comments

To improve compatibility with different WebSocket libraries, introduce an abstraction layer via a WebSocket adapter interface. Provide a default implementation using golang.org/x/net/websocket and allow custom adapters for libraries such as github.com/coder/websocket and github.com/gorilla/websocket.

Proposed approach:

  • Define a unified WebSocketAdapter interface that covers connect/upgrade, read, write, close, and error handling, including binary/text frames and context cancellation.
  • Implement the default adapter based on golang.org/x/net/websocket.
  • Expose clear extension points so users can implement adapters for other libraries (e.g., coder/websocket, gorilla/websocket).
  • Document how to implement and plug in a custom adapter.

This change increases extensibility and decouples go-vncproxy from any specific WebSocket library.

evangwt avatar Sep 28 '25 16:09 evangwt