-
Notifications
You must be signed in to change notification settings - Fork 108
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
How to parse delimited messages #61
Comments
Currently there's no way to do this automatically. I'm assuming your stream is exposed as a Haskell
I don't know if there's any standalone code for reading a varint (there probably ought to be). You could try copying proto-lens's internal routine, for example adapting its inner loop to read bytes from a |
ah ok, so there is not some obvious function i somehow missed. I hoped this would be an easy, straightforward project to do some practical haskell stuff ;) It still looks doable, i just might try solving it. If i get it to work and am confident in the code, would an PR be welcome, or is this too much of an edge case? The PR would probably need some serious reviewing, since i am not yet well versed in best practices/code style etc. |
Hm...too be honest, such a function might be better as a separate package, at least until proto-lens has a better story around streaming in general. For example, we could provide
and you could use |
ok, that makes sense! thank you. |
This was done by #268. |
well, this was a long time ago! Thanks! |
@judah I think, this is not quite done yet. The new I'm facing the problem right now and curious if you agree that's an issue. And if so, what would be the plan to tackle it. |
Hm, I think you're right @ulysses4ever. Previously we were using a streaming parser based on attoparsec, which would have made this possible. But in proto-lens-0.5, we switched to a strict parser that needs a strict I think it's reasonable to add more functionality to proto-lens to handle this use case. One idea I can think of is an API directly using Handles, which would copy the implementation of
(I'm not wild about duplicating the code, but don't see another obvious way forward; maybe having some tests to verify the new code would be sufficient.) Would you be interested in sending a PR? |
@judah thanks for your reply! Yes, I'm interested in making a PR, given that I've already mostly implemented it in my project. I am gonna test it first, and then make a PR. |
I got a socket connection that is used to stream data with delimited protobuf messages (see this). In the java api there is an convenient method called parseDelimitedFrom. How can this be achieved using this library?
I am new to haskell, so i might have overlooked something. I am sorry if this is very obvious.
The text was updated successfully, but these errors were encountered: