ninjasource / embedded-websocket

A rust websocket library for embedded systems (no_std)
Apache License 2.0
98 stars 28 forks source link

Add continuation message type for fragmented write #4

Closed chemicstry closed 4 years ago

chemicstry commented 4 years ago

The WebSocket::write documentation explains how to send fragmented packets, however, it does not mention that each subsequent message must have ContinuationFrame opcode, which is not exposed.

This PR exposes it so a valid fragmented frame can be constructed.

ninjasource commented 4 years ago

Hi Jurgis, thank you for raising this bug! I took a look at the code and, although it fixes the issue, I think this can be fixed without a minor version change like the one you are proposing (unfortunately, adding a new item to an enum in rust is a breaking change to an api). The continuation frame should be a hidden internal implementation detail anyway and we just need to keep track of the end_of_message flag the user passes. I have an idea about how to solve this where it will only be a patch version change.

ninjasource commented 4 years ago

Ok, this should now be fixed, thanks again for reporting it and I'm sorry I couldn't use your PR. I do welcome PRs but in this case the approach was totally different. I have published a new version on crates.io too.