-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Issue decoding after migrating from 4.x to 6.6.3 #670
Comments
Do you have an example buffer / proto at hand? |
Yup - I'll share one shortly
…________________________________
From: Daniel Wirtz <notifications@github.com>
Sent: 01 February 2017 16:26:05
To: dcodeIO/protobuf.js
Cc: John Reilly; Author
Subject: Re: [dcodeIO/protobuf.js] Issue decoding after migrating from 4.x to 6.6.3 (#670)
Do you have an example buffer at hand?
-
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#670 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AA9rXUHMMJVwxgtdHjxnPJbJOv_HILkjks5rYLIdgaJpZM4L0Cci>.
|
Actually there's nothing that I'm allowed to share.... Frustrating. I'll see if I can get a repro with one of the examples and share that. |
There is also a little howto on how to reverse engineer a buffer by hand in order to spot the underlying issue. |
Thanks I'll take a look! |
I'm not at a keyboard and so can't test but I just noticed the presence of a |
ParseOptions, goes there: https://github.com/dcodeIO/protobuf.js/blob/master/src/root.js#L70 |
So worth trying? Has the camelCase thing only be around since v6 then? |
v5 had a global option. v6 uses camel case by default, which can still be overridden with |
And |
Nope |
OK - it seems likely that the problem lies with Namely I can't actually read from the |
OK. It's a little strange but I have a workaround. I take the data I receive from the websocket and treat the supplying
This cloned array will give me what I need. Very strange but I thought it was probably worth sharing... |
Yeah, using Uint8Array in the browser / Buffer under node.js is correct. ArrayBuffer alone does not provide ways to manipulate the data (at least not within all environments). Uint8Array is not cloning, by the way, it is creating a view on the raw binary data.
|
Thanks for the clarification - I'd missed that |
Is it worth mentioning somewhere in the docs that users might need this approach if they are consuming |
The API documentation always refers to |
I was actually more thinking about the |
Yeah, added that to the first example in README. It's intentional that it doesn't accept an ArrayBuffer for perf reasons (avoids the additional assertion). |
Oh I saw - my point was more that people may not realise that they have an |
Actually it's covered here: https://github.com/dcodeIO/protobuf.js/wiki/How-to-read-binary-data-in-the-browser-or-under-node.js%3F I wonder if this section merits promotion to the readme? Or a link off to it perhaps? |
Closing as all my issues are resolved; thanks for your help @dcodeIO! |
protobuf.js version:
6.6.3
Hey it's me again 😉
I've just attempted an upgrade from v4 to v6. With v4 I was generating js files like so:
With v6 I'm doing it like so: (I've also attempted with commonjs as well)
However, decoding always fails for me. Specifically, when I debug
Reader.prototype.uint32
always produces 0:It's rather strange and so I wanted to report in case I'm doing anything dozy... If there's any ideas I'd greatly appreciate them!
The text was updated successfully, but these errors were encountered: