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 .close(), and document clean WebSocket closing #2974

Merged
merged 5 commits into from
Oct 11, 2024

Conversation

SabrinaJewson
Copy link
Contributor

Motivation

The current .close() method is mostly useless, because it does not allow sending a close frame and takes ownership of the WebSocket, which even forbids implementing the normal WebSocket close handshake.

Solution

Remove .close(), and document the behaviour of WebSocket close handshakes.

Closes: #2964

Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

Thanks! Got a few questions / suggestions about the new docs.

axum/src/extract/ws.rs Outdated Show resolved Hide resolved
axum/src/extract/ws.rs Outdated Show resolved Hide resolved
axum/src/extract/ws.rs Outdated Show resolved Hide resolved
SabrinaJewson and others added 2 commits October 11, 2024 09:13
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
axum/src/extract/ws.rs Outdated Show resolved Hide resolved
@jplatte jplatte enabled auto-merge (squash) October 11, 2024 08:56
@SabrinaJewson
Copy link
Contributor Author

Ah. I capitalied “axum” based on other examples in the repo of it beïng capitalized. They should probably be removed, I guess.

@jplatte jplatte merged commit c6e6b4e into tokio-rs:main Oct 11, 2024
18 checks passed
@jplatte
Copy link
Member

jplatte commented Oct 11, 2024

Yeah, it should. In the readme it's consistently lowercase.

@SabrinaJewson SabrinaJewson deleted the ws-close branch October 11, 2024 09:48
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.

Expose Websocket close frame when closing from server side
2 participants