beve transported on sockets #569
Replies: 1 comment 9 replies
-
Ah, interesting! I've actually been writing an RPC specification for BEVE. I just made it public so that I can get your thoughts on it: https://github.com/stephenberry/repe I've been designing it with insights into performance issues with the JSON RPC specification, but still quite similar. One important design consideration was that the header must not be enclosed in the same object as the body, because we want to be able to efficiently parse this separately and not require double parsing or the entire message to be received. This pertains to the issue you raised. I don't think it is a good idea to have a fixed size header, because I think using method names is extremely helpful for generic code and RPC frameworks. However, this specification solves that problem by using a BEVE array, which lets you know how many parameters to parse, and each parameter has known sizes. But, to make this even simpler, we separate the header, parameters, and body with BEVE delimiters, so that users can write a bit cleaner code and switch on value tags. This way you know you've read your entire header when you've hit the first BEVE delimiter. I see that you included the payload size in your header. I'm really torn about this. I don't like the idea of needing to have my entire payload defined prior to sending my header. And, the BEVE specification sends sizes of all values, so you can still reserve memory on individual elements. And, in networking typically you are using a fixed size input buffer anyway. I'd love to hear your thoughts on this. I haven't made much progress on implementing this spec yet in Glaze, but I have plans to do much more effort soon. There's been a branch: |
Beta Was this translation helpful? Give feedback.
-
I am thinking of changing to
beve
for interprocess communications via unix domain sockets. Currently using manual encode/decode methods.What I am not able to wrap my head around is the size of the message, if I receive partial packet I would need to concatenate the binary buffer before trying to convert it.
What I was thinking is having a header before the payload in the binary buffer,
When I would write
header_t
will the resulting binary output be of fixed size? I would like to expect on the receiving end some fixed size before conversion back toheader_t
.Beta Was this translation helpful? Give feedback.
All reactions