Quantcast

how to push stuff to the browser

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

how to push stuff to the browser

Andrew-7
Hi,

I am trying to design a text messaging service with cherrypy.

Can someone give me some advice about how to push some notification to the browser eg when there is a new message that arrives?

I have tried to use yield statements, but I want to make like some box start flashing or something when a message arrives, and I think I cannot do this with yield statements.

Thanks.

Andrew

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to push stuff to the browser

Tim Roberts
Andrew wrote:
>
> I am trying to design a text messaging service with cherrypy.
>
> Can someone give me some advice about how to push some notification to
> the browser eg when there is a new message that arrives?
>
> I have tried to use yield statements, but I want to make like some box
> start flashing or something when a message arrives, and I think I
> cannot do this with yield statements.

You cannot "push" anything to a browser.  That's just not how the web
works -- it is entirely a "pull" technology.

Instead, the web page you send must have Javascript code that
periodically polls your server to see if there is something new.  You
can do that with "refresh", but it's more common to use AJAX requests.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to push stuff to the browser

cherrypy-users mailing list


You cannot "push" anything to a browser.  That's just not how the web
works -- it is entirely a "pull" technology.


Or you can use websockets to reallypush the data to the client.
On the cherrypy side there is ws4py that also has cherrypy integration.

On the client side you need suitable javascript aswell.
 
Björn

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to push stuff to the browser

Andrew-7
Hi Bjorn and Tim,

Thanks for you responses.

Does anyone have any idea what kind of technology google hangouts uses?

It seems to work pretty well.

I don't see repeated http requests from the Chrome "Developer Tools" thing when I use google hangouts when there are no messages being sent, so I guess it does not use polling from the browser.

Andrew

On Friday, September 2, 2016 at 3:06:13 PM UTC+2, Björn Pedersen wrote:


You cannot "push" anything to a browser.  That's just not how the web
works -- it is entirely a "pull" technology.


Or you can use websockets to reallypush the data to the client.
On the cherrypy side there is ws4py that also has cherrypy integration.

On the client side you need suitable javascript aswell.
 
Björn

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to push stuff to the browser

Tim Roberts
Andrew wrote:
>
> Thanks for you responses.
>
> Does anyone have any idea what kind of technology google hangouts uses?
> ...
> I don't see repeated http requests from the Chrome "Developer Tools"
> thing when I use google hangouts when there are no messages being
> sent, so I guess it does not use polling from the browser.

They use a proprietary protocol to communicate with their server.  It's
not HTTP.  They probably do what Björn suggested and set up a websockets
connection to transfer the video.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Loading...