-
Notifications
You must be signed in to change notification settings - Fork 14
Feature Request for 'Streaming Requests' #13
Comments
The following might work - assuming that
Note that this does not provide a means for closing the client connection after a specified number of json responses have been processed. It also assumes that that the json s are newline separated. |
Amit, Thanks. Unfortunately, it doesn’t seem to work. This evening, I will see if playing with various combinations of options might work. I had previously tried redirect_stout() with various assumptions for options. The only thing that I could get to work was to set ostream=“some_file", set total_time=“low_time_out”, catch the time_out_error and read/parse “some_file”. Not very elegant . . . Thanks, Bryan
|
I believe the server is using Server Sent Events. Here is a link: https://segment.io/blog/2014-04-03-server-sent-events-the-simplest-realtime-browser-spec/ |
As part of JuliaLang/julia#9434, an in-memory buffer, |
Thanks for addition and great responsivness! Appreciate it. |
It has been merged in 0.4 If you are using 0.3, you could try defining I have reproduced it below. Do try it out and let me know if it works.
|
Sorry, the close was accidental. You may have to replace |
I will upgrade to HEAD and test out this evening. Thanks! |
Clearly, I'm missing something:
|
Try with option |
With |
Previously I tried
|
Is it blocking on Also, instead of the |
Also, can you paste some raw server output? Would like to see if the output JSON's are separated only with CRs or are they CR-LF, or just LFs. I can see a problem if they are carriage returns only. |
I simulated the same with a dummy streaming server and I can see the issue. Will debug it in a while. |
No luck. With Here is a redacted raw output when using
|
Amit - Thanks for working on this. I am way out of my league. . . |
I found the issue. While I put out a patch, you can try with the following workaround:
Note the |
Success! Adding |
Patched. The problem was in HTTPC.jl, line number 243, where a deepcopy of RequestOptions caused a new BufferStream to be created. |
Patch checks out for me. Thanks! |
'Streaming Requests' is a feature that is implemented by the Python package 'Requests': http://docs.python-requests.org/en/latest/user/advanced/#streaming-requests
It would be great to have the same feature in HTTPClient.jl.
A sample use case would be iterating over streaming API's. For example, a GET request that returns a continuous stream of json objects.
My specific need is being able to monitor a remote sensor that returns continuous voltage readings (in json format) in response to a GET call.
Thanks,
Bryan Daniels
The text was updated successfully, but these errors were encountered: