-
Notifications
You must be signed in to change notification settings - Fork 94
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
Send multi-frame messages? #21
Comments
The ability to specify the framing is not present in the ASGI specification. I think you could make an argument that it should be an ASGI extension. I've opened this issue to get views. |
Could you comment on the ASGI ref issue? |
Why change the ASGI spec? message.bytes can be an iterable of text or bytes, and in that case it should iterate through it and send BytesMessage(..., message_finished=False) similar to what the websockets lib did here. |
Making the text or bytes an iterable would break one of the ASGI spec assumptions (that each message is complete and immutable). Whilst I could do this, the purpose of Hypercorn is to be an ASGI server, so I don't think it would be the right thing to do. I think the only option is an ASGI extension that allows for this - which would require a motivating use case. |
If that's the case then there should be a note in the documentation disclosing that hypercorn/quart doesn't fully implement the websockets protocol (rfc6455), in particular the continuation frames, so that whoever wants to use these libs is aware of the limitation. The most obvious use case is server sending a message of unknown length (e.g. streams like compressed files, live media streaming, etc.) or buffered large file transfers. In my case I was only testing the protocol and was hoping that I'd get the same functionality as with the websockets library. |
I think the documentation is sufficient, in that Hypercorn claims to be an ASGI compliant server rather than a complete WebSocket server. I think there is a case for this being an ASGI extension though, it does require convincing others in the ASGI issue though. |
Currently I don't see any way to send a message that spans multiple frames.
Briefly looked through the code and
await self.asend(BytesMessage(data=bytes(message["bytes"])))
basically initializes aBytesMessage
withmessage_finished=True
every time.Is there a plan to add that? Or am I missing something?
The text was updated successfully, but these errors were encountered: