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

Consider supporting buffer types other than Vec<u8> for binary Messages #353

Closed
chuigda opened this issue May 6, 2023 · 1 comment
Closed
Labels

Comments

@chuigda
Copy link

chuigda commented May 6, 2023

I personally want to get a somewhat more aligned buffer for received binary messages somehow, in order to do some in-place dirty dirty things. and I guess there should be some real world use cases. I wonder if such feature can be added, or if there could be some workarounds.


An alternative option, as far as I've considered, is to utilize the allocator_api but it's still unstable.

@chuigda chuigda changed the title Consider supporting types other than Vec<u8> for binary Messages Consider supporting buffer types other than Vec<u8> for binary Messages May 6, 2023
@daniel-abramov
Copy link
Member

It seems like it's having a broad overlap with #96 and the corresponding PR, i.e. we thought about changing the underlying type for the Message to not enforce owned data when calling write_message(). This won't quite work with any data type that you've mentioned ("in place dirty dirty things" 😉 ).

Or, to be more precise, there have been discussions around splitting the sans I/O part of the library into tungstenite-core that is generic over the data (read accepts a buffer, write accepts a buffer also, no I/O on streams) and then make tungstenite and tokio-tungstenite wrappers around it. But we have not come up with a plan (though PRs or changes in this direction are welcome).

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

No branches or pull requests

2 participants