---
Hello,
I was thinking if it would be beneficial to add a note about sending
BARE messages over a stream protocol to the "Application Considerations"
section of the BARE draft.
Thank you for your opinion.
draft-devault-bare-08.xml | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/draft-devault-bare-08.xml b/draft-devault-bare-08.xml
index 0551d5e..87cb3ce 100644
--- a/draft-devault-bare-08.xml+++ b/draft-devault-bare-08.xml
@@ -635,6 +635,23 @@ type Message union {MessageV1 | MessageV2 | MessageV3}
<artwork><![CDATA[
type Message union {MessageV2 = 1 | MessageV3}
]]></artwork>
+ <t>+ Message authors who wish to deliver the message using a stream protocol+ should add a length as the first field of the message to explicitly+ indicate the boundaries of the message.+ </t>+ <t>The following schema provides an example:</t>+ <artwork><![CDATA[+type MessageWithLength struct {+ len: u32+ msg: Message+}+]]></artwork>+ <t>+ Thus, the reception of the message over a stream protocol consists of+ two phases. First, the reception and decoding of the length. Second,+ the reception and decoding of the message.+ </t> </section>
<section>
--
2.34.1
Hi Jiri!
I am wondering if this could be simply done by treating the message as
an opaque sequence of bytes of another message:
```bare
type EmbeddedMessage = ...
```
```bare
type MainMessage = data
```
```code
let bytes = encodeEmbeddedMessage(x)
let msg = encodeMainMessage(bytes)
```
have a nice day!
Hi Victorien,
> I am wondering if this could be simply done by treating the message as> an opaque sequence of bytes of another message:
I am afraid that not. To my understanding, when using streamed protocol
like TCP, you don't know where is the end of the message. So you need to
send the message length first.
BARE message with data primitive type (of arbitrary length) requires the
length of the data to be encoded before the data itself as uint.
However, the uint data type has no fixed length, so the length of the
uint is not known in advance, resulting in the same problem as the
original one.
Please, correct me if I am wrong.
Thank you!