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

Remove requirement for handshake dependencies #296

Open
Icelk opened this issue Aug 23, 2022 · 6 comments
Open

Remove requirement for handshake dependencies #296

Icelk opened this issue Aug 23, 2022 · 6 comments

Comments

@Icelk
Copy link
Contributor

Icelk commented Aug 23, 2022

Hi. Thanks for the great code!

Is it possible for you to add a cargo feature for the handshake code? I'm handling the handshake manually, so the dependencies pulled in (like httparse) are unnecessary.

I can make a PR if you'd like. Thanks!

@daniel-abramov
Copy link
Member

Hey, thanks.

I think it's totally possible, but might result in too many #[cfg(..)] at certain places I think. As far as I understood it, additional dependencies (like httparse) is a big deal in your case, so your solution would benefit from a slightly leaner dependency, right?

@Icelk
Copy link
Contributor Author

Icelk commented Aug 24, 2022

Precisely. It feels wrong to include unused code, especially whole dependencies. Increases compile time and attack vectors. But I do understand if you'd prefer not to add additional #[cfg()] attribute. The reduction of dependencies is just a nice-to-have in my case, as I've gated the entire WebSocket feature behind #[cfg()].

@daniel-abramov
Copy link
Member

Got it. If it does not change the code-readability much, I would be totally ok with it :)

@Icelk
Copy link
Contributor Author

Icelk commented Aug 25, 2022

Nice! Then I'll send a PR to this repo and to tokio-tungstenite this weekend. Thanks!

@Icelk
Copy link
Contributor Author

Icelk commented Aug 29, 2022

@application-developer-DA I've sent the PRs :)

@tqwewe
Copy link

tqwewe commented Aug 31, 2022

Hey @Icelk , is it currently possible to make a WebSocket instance with skipping the handshake? In my case, I'm also handling the handshake manually, but can't figure out how to use this library without the handshake.

EDIT: Nevermind! I just found tungstenite::protocol::WebSocket::from_raw_socket

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

No branches or pull requests

3 participants