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

Ensure text message exists before handling on WebsocketConsumer #2097

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cacosandon
Copy link

When using uvicorn or daphne, only one of text or bytes is sent.

But on hypercorn, both of them are sent, but with None value:
https://github.com/pgjones/hypercorn/blob/31639ec2f4d03aa920b95c84686163901224c6cf/src/hypercorn/protocol/ws_stream.py#L159

So if you just send bytes, text will be None and you won't be able to handle the message.

I just add an extra check.

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.

None yet

1 participant