Hi Kimmy,

> On 27 Dec 2018, at 15:15, Jimmie Houchin <jlhouc...@gmail.com> wrote:
> 
> Hello,
> 
> I am wanting to subscribe to a perpetual stream of JSON data in my app. I 
> have failed to find an example which helps me understand       how to do so. 
> It may be there but I have not discovered it.
> 
> How do I do something like that? A curl example from the website.
> 
> curl \
>   -H "Authorization: abcdefg?????" \
>   
> "https://stream-mystreamingsite.com/stream?query=whatIwant";
> Response Headers
> HTTP/1.1 200 OK
> Access-Control-Allow-Headers: Authorization, Content-Type, 
> Accept-Datetime-Format
> Access-Control-Allow-Methods: PUT, PATCH, POST, GET, OPTIONS, DELETE
> Access-Control-Allow-Origin: *
> Content-Type: application/octet-stream
> 
> 
> After subscribing to the stream I will need to get and access the JSON data 
> so that my app can process it.
> 
> Any help and wisdom greatly appreciated.
> 
> Thanks.
> 
> Jimmie

The client and server part of the WebSockets extension to Zinc HTTP Components 
already supports similar functionality, so this is certainly doable.

Unless you can give me a public end point to test, I can only write some 
untested pseudo code.

| client reader |
client := ZnClient new.
client url: 'https://stream-mystreamingsite.com/stream?query=whatIwant'.
client streaming: true.
client headerAt: 'Authorization' put: 'xxx'.
client get.
reader := NeoJSONReader on: (ZnCharacterReadStream on: client contents).
[ reader atEnd] whileFalse: [ reader next ].
reader close.
client close.

Be sure to tell us how you got it working.

HTH,

Sven


Reply via email to