Skip to content

Abstract a WebSocket adapter interface to support multiple libraries #37

@evangwt

Description

@evangwt

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions