Description
I'm trying to port https://github.com/rsms/gotalk to use gorilla websockets instead of x/net/websocket. However, it uses a common underlying handler for both the raw TCP stream, and websockets stream. The websockets one uses /x/net/websocket where it upgrades the connection, and the passes it on to the raw TCP handler, that handles things from there.
To be able to do this, x/net/websocket is pretty trivial. All it does is exposes the Conn after the upgrade that can be sent as a ReadWriteCloser. I'm wondering if it's possible to achieve this using Gorilla websockets, while still retaining the higher level features like compression that gorilla socket provides. From what little I looked under the hood, it only seems to have the raw underlying connection conn
which cannot be passed since it will include the websocket framing, and reader and writer which are exposed through NextReader
and NextWriter
which can change. Any way to do this without writing a complicated abstraction layer on top of NextReader/NextWriter?