Hello.

I have (working on) Rust service and clients ( Rust and Node.js). I want 
service<->client cap'n'proto message exchange via Tcp socket (no HTTP). 
Messages will go via tcp connection, but I have different message types 
(each message is structs Login, or CommandGetData or Error...). So how can 
I distinguish which message Type I got from tcp bytes stream (and I need to 
know it's size too).

I decided to prefix each message with UInt32 type and size (8 bytes total). 
Probably JS can read raw bytes. Or I can prefix Messages with fixed size 
unpacked message (struct - 24 bytes).
struct MessageHeader { 
 type @0: UInt32; 
 size @1: UInt32; 
}

So what is good solution for this task? I think it was already solved many 
times. I understand, that RPC will solve this as JSON messages. But I do 
not want use RPC right now.

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/7b42273c-8e4b-4a70-b661-d6dd7b014367n%40googlegroups.com.

Reply via email to