Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ and JS compatability #1996

Open
SvenGebert opened this issue May 27, 2024 · 2 comments
Open

C++ and JS compatability #1996

SvenGebert opened this issue May 27, 2024 · 2 comments

Comments

@SvenGebert
Copy link

protobuf.js version: 7.3.0, C++ protobuf version 21.4

Is it acutally possible to decode cpp-encoded protobuf objects with protobufs.js 7.3.0 and vice versa?
Currently C++ protobuf version 21.4 and protobuf.js version: 7.3.0 are not working well, the generated buffers are quite different.
Is it likely to work with the newest C++ version 27.0?

@murgatroid99
Copy link
Contributor

Have you tried encoding with one and decoding with the other?

The protobuf spec allows for some variance in how a message can be represented; in particular, the fields can be serialized in any order. As a result, very different looking buffers can represent the exact same message.

@SvenGebert
Copy link
Author

Hey, thanks for your quick response!

Yeah I've encoded a message with c++ and were able to decode it on the javascript side by adding 2 missing header bytes and what seems like padding at the end. Vice versa is just not possible. And it seems like there is no tolerance in encoding right now. I ll try updating the c++ version tho!
If anyone has idea please comment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants