Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native split support without Sink #155

Open
joshtriplett opened this issue Feb 18, 2025 · 0 comments
Open

Native split support without Sink #155

joshtriplett opened this issue Feb 18, 2025 · 0 comments

Comments

@joshtriplett
Copy link
Contributor

Filing this based on the discussions starting at #152 (comment) . I don't plan to write this support myself, but if it existed I'd be thrilled to use it.

Currently, splitting a WebSocketStream into a write and read side requires Sink support and futures_util::stream::StreamExt::split.

To support splitting without that, we could have a native function WebSocketStream::split() returning a WebSocketSender that has the send function, and a WebSocketReceiver that implements Stream. If the sink feature is enabled, WebSocketSender can implement Sink.

With that support, ByteReader can continue to always expect a Stream. ByteWriter can support any Sink if the sink feature is enabled, or support only WebSocketStream and WebSocketSender otherwise (using a sealed trait).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant