When a MessageChannel is converted to a reader it looses the original message length because the reader might not request reading all of the payload from the channel.
But it's important to preserve the original length of the payload just because some modules are message oriented. For example, websocket will emit one payload per websocket message. If one function reads from a channel reader, it won't have the ability to restore that entire message.
This is why it could be useful to migrate all message channels to add the length of the payload in uint32 little endian. The reader could just read the 4 first bytes and decide either it wants to read up to the length or not.
When a
MessageChannel
is converted to areader
it looses the original message length because the reader might not request reading all of the payload from the channel. But it's important to preserve the original length of the payload just because some modules are message oriented. For example,websocket
will emit one payload per websocket message. If one function reads from a channel reader, it won't have the ability to restore that entire message.This is why it could be useful to migrate all message channels to add the length of the payload in
uint32
little endian. The reader could just read the 4 first bytes and decide either it wants to read up to the length or not.