websockets-rs / websockets-rs/rust-websocket

Impossible to implement async `IntoWs`?

Open
#198 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
225
PR merge metrics
No merged PRs in 30d

Description

My goal is to build an object-pool Codec implementation to avoid allocations for all the frames/messages that come through a websocket. However, despite server/mod.rs mentioning the IntoWs trait, it appears impossible to implement in a separate crate because Upgrade in upgrade/async.rs is a struct that I can't patch the implementation for. Thus, I'd be able to adapt the underlying stream (so having new exotic things beyond just what tokio provides), but the protocol details are hidden from other crates.

Am I understanding this correctly? And is that all the more reason for #180 or extracting WsUpgrade into a trait?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading server/mod.rs, server/upgrade/async.rs, and server/upgrade/mod.rs, focusing on the visibility and relationships among IntoWs, Upgrade, and WsUpgrade. Confirm what external crates can implement or customize; done requires a maintainer-approved API design that makes the intended protocol extension possible without breaking existing users.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.