http-rs/surf

WebSocket client support

Opened this issue · 4 comments

gmosx commented

Are there any plans to support WebSocket within Surf?

Why not just use async-tungstenite?

Someone in discord was talking about this recently rtyler I think. I don't know their github handle.

It may just be that no one has needed it enough to spend the time, not sure.

I think the right ordering to adding websocket support to Surf is:

  • build bindings to the window.WebSocket interface for localghost
  • integrate those bindings into surf for the WASM target
  • integrate async-tungstenite (or similar) into surf using the same interface

The reason for this ordering is that we've observed for SSE that the browser's API exposes a subset of what the protocol is capable of delivering. So in order for Surf to continue to work on all platforms we should target the lowest common denominator.

One reason to support this natively: it could integrate with connection reuse, to allow sending a request, getting back a response, and then opening a websocket, all on the same connection.