You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is one of the pieces of work that enables iroh in the browser.
At the moment, relay clients connect via HTTPS and upgrade using the upgrade protocol iroh derp http.
This issue is solved once we add support for websocket as an HTTP upgrade and then talk websocket framing.
Ideally, this upgrade will be backwards-compatible. Clients connecting with iroh derp http should still be able to talk to updated relays, and websocket-based clients should be able to talk to iroh derp http-based clients.
…2387)
Implements the `websocket` protocol upgrade in iroh-relay and changes
`iroh-net` clients to connect with `websocket` instead of `iroh derp
http`.
State of this is:
- `cargo test -p iroh-net` runs green
- websocket on the relay is supported
- backwards compatibility is tested
- the client also supports connecting using websockets
- (but we're forced to use tungstenites connection establishment, no
custom `MaybeTlsStream`.)
- It decides this via the URL scheme (`ws(s)://` vs. `http(s)://`)
TODO:
- [x] Enumify the client so it's possible to keep using the old relay
protocol
- [x] Cleanup!
- [x] Some perf TODOs in the server, less copying.
- [x] Update documentation (e.g. `local_addr` having another case being
`None`)
- [x] Add metrics for websocket-accept & derp-accept counts
- [x] Snapshot tests (using `parse_hexdump`) for "new" wire format
## Description
- Supports clients connecting to iroh-relay with websockets & running
the derp protocol over websocket `Binary` msgs.
- Adds support for the relay answering `Upgrade: websocket` headers
instead of `Upgrade: iroh derp http` appropriately.
- Adds support for `ClientBuilder` to dial via websockets, if the relay
URL is set with a `ws`/`wss` URL scheme.
## Breaking Changes
- Not in the protocol: The old HTTP upgrade & protocol should still be
supported. There's tests to ensure this.
- `Client::local_addr` will now also return `None`, if one connected
using websockets.
- `iroh_net::relay::http::ClientError`: Added a variant `WebsocketError`
for errors when establishing a connection using websockets.
## Notes & open questions
Closes#2370
## Change checklist
- [x] Self-review.
- [x] Documentation updates if relevant.
- [x] Tests if relevant.
- [x] All breaking changes documented.
This is one of the pieces of work that enables iroh in the browser.
At the moment, relay clients connect via HTTPS and upgrade using the upgrade protocol
iroh derp http
.This issue is solved once we add support for
websocket
as an HTTP upgrade and then talk websocket framing.Ideally, this upgrade will be backwards-compatible. Clients connecting with
iroh derp http
should still be able to talk to updated relays, and websocket-based clients should be able to talk toiroh derp http
-based clients.Previous work happened on this branch: main...feat-websockets
The text was updated successfully, but these errors were encountered: