oskaritimperi / nimpb

Protocol Buffers for Nim
MIT License
37 stars 6 forks source link

Need an option to specify if writing with length prefix into protobuf message #16

Closed geohuz closed 4 years ago

geohuz commented 4 years ago

In the nim protobuf package there is a writeSize parameter, so we can have the message length indicator in the packet,

proc write(s: Stream; o: ds_Challenge; writeSize = false) =
  if writeSize:
    s.protoWriteInt64(o.len)
  ...

But I didn't find this parameter in the nimpb, the protobuf server I'm now communicating with need this length prefix in the packet, so it is good to have.

oskaritimperi commented 4 years ago

That is something that the user can do very easily. I'm not comfortable with dictating how the user should delimit their messages. Some users might want to use smaller length tags and some bigger.