outline-sdk icon indicating copy to clipboard operation
outline-sdk copied to clipboard

Replace Websocket library

Open fortuna opened this issue 1 year ago • 3 comments

We are using https://pkg.go.dev/golang.org/x/net/websocket, which is poorly maintained.

Better options are:

  • https://pkg.go.dev/github.com/gorilla/websocket
  • https://pkg.go.dev/nhooyr.io/websocket

Ideally we would be able to support Websockets over h2 and even h3, for multiplexing and better performance.

However, it's not clear any implementation can support it yet, given limitations in the http2 support in Go:

  • https://github.com/golang/go/issues/53209
  • https://github.com/golang/go/issues/49918

fortuna avatar May 07 '24 01:05 fortuna

Oh, neither of the libraries support h2 :-/

  • https://github.com/nhooyr/websocket/issues/4
  • https://github.com/gorilla/websocket/issues/417

fortuna avatar May 07 '24 01:05 fortuna

We can consider adding h3 support with quic-go: https://quic-go.net/docs/webtransport/

fortuna avatar May 07 '24 01:05 fortuna

We can consider adding h3 support with quic-go: https://quic-go.net/docs/webtransport/

There are RFC 9220, websocket over http/3.

I have implemented in nginx, make nginx support proxy http2/http3 websocket to websocket 1.1 backend. And even make a simple client to use, as a sip003 plugin.

liudongmiao avatar Jun 15 '24 14:06 liudongmiao