jiffy
jiffy copied to clipboard
Add return_truncated decode flag
The use case is that I have a protocol which takes JSON over streaming sockets (TCP, websocket). JSON is basically the "framing" format. Because of the properties of the protocol, you can get partial frames. In that case, I know to go ahead and wait for more and add it to the buffer before trying to decode again.
I know that JSX has a streaming API, but I personally find it really difficult to use, especially when my messages are <16KB. A simple decode, append, continue loop works just fine.
That makes sense but with the return_trailer and existing trucated exception I’m not seeing what the extra position is giving. Seems like it’d always be the end of the binary no?
On Wed, Nov 22, 2017 at 4:16 PM Sargun Dhillon [email protected] wrote:
The use case is that I have a protocol which takes JSON over streaming sockets (TCP, websocket). JSON is basically the "framing" format. Because of the properties of the protocol, you can get partial frames. In that case, I know to go ahead and wait for more and add it to the buffer before trying to decode again.
I know that JSX has a streaming API, but I personally find it really difficult to use, especially when my messages are <16KB. A simple decode, append, continue loop works just fine.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/davisp/jiffy/pull/158#issuecomment-346487711, or mute the thread https://github.com/notifications/unsubscribe-auth/AABN2Usdu-86vmbHTaKXkW2jrdWDMeCPks5s5J01gaJpZM4QnIKW .
Yeah, I'd think so, the only reason I'm returning the extra position is because I wanted it to be as similar to the existing API mechanism as possible. I agree, it doesn't make a lot of sense, but I'd hate to break API backwards compatibility.
Fixed the braces.
How do you want to proceed?