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

Improve WebSocket close implementation #200

Merged
merged 2 commits into from
Jan 1, 2024
Merged

Conversation

dolfies
Copy link
Contributor

@dolfies dolfies commented Dec 31, 2023

  • Allow passing close code/message directly to close()
  • Fix aclose() not accepting parameters
  • Implement close code/message parsing and provide to on_close handler
    • Might make sense to put this in recv() and return a class instance containing parsed data instead of raw bytes, similar to aiohttp
  • Add close code enum and expose WebSocket enums
  • Close socket on protocol error (as per spec)
    • Should probably check for other protocol errors in the future and raise accordingly
    • Clients are supposed to reply with a close message whenever they receive a close frame no matter what (as per spec), so consider doing that as well (though not entirely necessary, can be left up to user)

Copy link
Collaborator

@perklet perklet left a comment

Choose a reason for hiding this comment

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

LGTM

@perklet perklet merged commit 4d8683f into lexiforest:main Jan 1, 2024
3 checks passed
@dolfies dolfies deleted the fix/wsclose branch December 1, 2024 13:18
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.

3 participants