Skip to content

Add support for message delimiting #13

@ghost

Description

Google's Java implementation of protobuf provides the writeDelimitedTo/parseDelimitedFrom methods, basically just prefixing individual messages with their length and thus allowing multiple messages to be combined in one output stream.

I've been trying to cobble this together myself, but I think it would be nice to have as part of the library as well. This would make API creation using your library much easier, since you might wanna support requests querying multiple resources/messages of one kind.

If you're not likely to implement this, could you maybe point me in the right direction for doing this myself? It's no problem for small messages (where the length fits into 8 bytes)

pack("c*", strlen($message->toStream()));

but for larger messages, packing with v* or V* produces errors on the client's side, because their length needs to be converted to a varint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions