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

Add protocol field to WebSocket #1022

Merged
merged 5 commits into from May 11, 2022

Conversation

MatteoJoliveau
Copy link
Contributor

Signed-off-by: Matteo Joliveau matteojoliveau@gmail.com

Closes #1020

I used String::from_utf8_lossy because I didn't want to add complex error handling for a corner case (non-UTF8 characters in an HTTP header) that, for this particular use-case, is pretty rare. I would have loved to use a Cow instead of a String inside of WebSocket to avoid an allocation, but I had a bit of a hard time fighting with lifetimes so I eventually conceded.

Feedbacks and suggestions welcome!

Signed-off-by: Matteo Joliveau <matteojoliveau@gmail.com>
axum/src/extract/ws.rs Outdated Show resolved Hide resolved
Signed-off-by: Matteo Joliveau <matteojoliveau@gmail.com>
axum/src/extract/ws.rs Outdated Show resolved Hide resolved
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Copy link
Member

@davidpdrsn davidpdrsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Wanna update the changelog as well?

@MatteoJoliveau
Copy link
Contributor Author

@davidpdrsn changelog updated!

@davidpdrsn davidpdrsn enabled auto-merge (squash) May 11, 2022 08:35
@davidpdrsn
Copy link
Member

Thanks!

@davidpdrsn davidpdrsn merged commit 2803343 into tokio-rs:main May 11, 2022
@MatteoJoliveau MatteoJoliveau deleted the feature/ws-protocol branch May 11, 2022 08:59
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

Successfully merging this pull request may close these issues.

WebSocket subprotocols negotiation
3 participants