Streaming API for Pharo?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Streaming API for Pharo?

Arturo Zambrano
Hi All,
 we are playing with Roassal for the visualization of Twitter data.
 So far we used Zn-SSO to connect to twitter and call REST API to 
get some tweets for playing.

 Now, we would like to use the streaming API. I could not figure out how to
do this with Zn-*.
  
 According to Twitter Streaming API docs:
Some HTTP client libraries only return the response body after the connection has been closed by the server. These clients will not work for accessing the Streaming API. You must use an HTTP client that will return response data incrementally

I would like to know if Zn  allows to get data incrementally. Furthermore it would be great to know if there is some example where I can start from.


Once we have our toy working we plan to release it to the community.

thanks.

art




Reply | Threaded
Open this post in threaded view
|

Re: Streaming API for Pharo?

Sean P. DeNigris
Administrator
Arturo Zambrano wrote
I would like to know if Zn  allows to get data incrementally
The Nabble mirror (http://forum.world.st/Pharo-f1294836.html will check both dev and user lists) has a great search feature. "Zinc stream" returned some interesting results...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Streaming API for Pharo?

Sven Van Caekenberghe-2
In reply to this post by Arturo Zambrano
Hello Arturo,

On 13 Feb 2014, at 15:00, Arturo Zambrano <[hidden email]> wrote:

> Hi All,
>  we are playing with Roassal for the visualization of Twitter data.
>  So far we used Zn-SSO to connect to twitter and call REST API to
> get some tweets for playing.
>
>  Now, we would like to use the streaming API. I could not figure out how to
> do this with Zn-*.
>  
>  According to Twitter Streaming API docs:
> Some HTTP client libraries only return the response body after the connection has been closed by the server. These clients will not work for accessing the Streaming API. You must use an HTTP client that will return response data incrementally
>
> I would like to know if Zn  allows to get data incrementally. Furthermore it would be great to know if there is some example where I can start from.
>
>
> Once we have our toy working we plan to release it to the community.
>
> thanks.
>
> art

Zinc HTTP Components is a framework that does allow you to do pretty much everything related to HTTP. I would suggest you load the Zinc WebSockets addon package:

https://github.com/svenvc/docs/blob/master/zinc/zinc-websockets-paper.md

In particular, look at ZnWebSocket class>>#to: where after an initial request/response interaction, the actual connection used in the client is taken and used to run a completely different protocol. I guess in your case you would then keep on reading responses.

But it might be simpler than that, if the server returns an actual infinite response, you could ask for ZnClient>>#streaming: true and use the resulting ZnStreamingResponse's contents (a stream) to keep on reading.

Good luck and let me know how it goes, I am pretty sure we can get this working !

If you can tell me how I can access such a response with my twitter account, I can try as well.

Sven
 


Reply | Threaded
Open this post in threaded view
|

Re: Streaming API for Pharo?

Arturo Zambrano
In reply to this post by Sean P. DeNigris
thanks! I will take a look at it.
art


On Thu, Feb 13, 2014 at 11:48 AM, Sean P. DeNigris <[hidden email]> wrote:
Arturo Zambrano wrote
> I would like to know if Zn  allows to get data incrementally

The Nabble mirror (http://forum.world.st/Pharo-f1294836.html will check both
dev and user lists) has a great search feature. "Zinc stream" returned some
interesting results...



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Streaming-API-for-Pharo-tp4743273p4743294.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Streaming API for Pharo?

Arturo Zambrano
In reply to this post by Sven Van Caekenberghe-2
Thanks Sven, I will give it a try.

Best regards
art


On Thu, Feb 13, 2014 at 4:35 PM, Sven Van Caekenberghe <[hidden email]> wrote:
Hello Arturo,

On 13 Feb 2014, at 15:00, Arturo Zambrano <[hidden email]> wrote:

> Hi All,
>  we are playing with Roassal for the visualization of Twitter data.
>  So far we used Zn-SSO to connect to twitter and call REST API to
> get some tweets for playing.
>
>  Now, we would like to use the streaming API. I could not figure out how to
> do this with Zn-*.
>
>  According to Twitter Streaming API docs:
> Some HTTP client libraries only return the response body after the connection has been closed by the server. These clients will not work for accessing the Streaming API. You must use an HTTP client that will return response data incrementally
>
> I would like to know if Zn  allows to get data incrementally. Furthermore it would be great to know if there is some example where I can start from.
>
>
> Once we have our toy working we plan to release it to the community.
>
> thanks.
>
> art

Zinc HTTP Components is a framework that does allow you to do pretty much everything related to HTTP. I would suggest you load the Zinc WebSockets addon package:

https://github.com/svenvc/docs/blob/master/zinc/zinc-websockets-paper.md

In particular, look at ZnWebSocket class>>#to: where after an initial request/response interaction, the actual connection used in the client is taken and used to run a completely different protocol. I guess in your case you would then keep on reading responses.

But it might be simpler than that, if the server returns an actual infinite response, you could ask for ZnClient>>#streaming: true and use the resulting ZnStreamingResponse's contents (a stream) to keep on reading.

Good luck and let me know how it goes, I am pretty sure we can get this working !

If you can tell me how I can access such a response with my twitter account, I can try as well.

Sven