[web2py] Re: Just knew about Server-Sent Events and want to share it with you

2013-04-05 Thread Paolo Caruccio
Well, I just tested version 2.4.5 Stable ts 2013.04.04.21.10.38 and all 
worked for me. What issue have you encountered?
Anyway, the code was and is experimental (for example it doesn't work on 
IE).

If do you want something more tested please try comet messaging included in 
web2py as Derek suggested in an other thread.

Il giorno venerdì 5 aprile 2013 02:26:23 UTC+2, Arnon Marcus ha scritto:

 Can you post the actual files? The w2p can't be imported to the latest 
 web2py...

 Also, some questions:

 1. The way I understand this, an implementation would be via a 
 controller-action that receives the event-stream-request, then responds 
 with a 200 OK and that MIME thing, to affirm the connection. But from 
 that point onward, new responses should be sent over the same open 
 connection. How is the response-object being generated and sent without a 
 request? How does it know where to send it to?

 2. I would like to make a shared-collaborative view for multiple users, 
 that any changed done by one, is reflected automatically in all the others. 
 How would I go about doing that? Since web2py executes on each request, I 
 would have to hold connection-data of all open-connections, in some 
 semi-persistent location - would I have to use some 
 external/internal caching? Is there some automatic session-saving already 
 built-in web2py that can be useful?


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Just knew about Server-Sent Events and want to share it with you

2013-04-04 Thread Arnon Marcus
Can you post the actual files? The w2p can't be imported to the latest 
web2py...

Also, some questions:

1. The way I understand this, an implementation would be via a 
controller-action that receives the event-stream-request, then responds 
with a 200 OK and that MIME thing, to affirm the connection. But from 
that point onward, new responses should be sent over the same open 
connection. How is the response-object being generated and sent without a 
request? How does it know where to send it to?

2. I would like to make a shared-collaborative view for multiple users, 
that any changed done by one, is reflected automatically in all the others. 
How would I go about doing that? Since web2py executes on each request, I 
would have to hold connection-data of all open-connections, in some 
semi-persistent location - would I have to use some 
external/internal caching? Is there some automatic session-saving already 
built-in web2py that can be useful?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Just knew about Server-Sent Events and want to share it with you

2012-09-10 Thread smoggy
Hey thanks !

That's something nice to have around, i prefer to hack+grow on some example 
than start from zero.

Anyway i guess that some two-way json-rpc could be implemented on top of 
SSE to make realtime streaming apps a breeze. As opposed to the 
complication of deployment that are websockets.

Ciao.

Segunda-feira, 10 de Setembro de 2012 17:07:19 UTC+1, Paolo Caruccio 
escreveu:

 Some time ago I converted the example of html5rocks (
 http://googlecodesamples.com/html5/sse/sse.html) in a simple web2py app. 
 Please pay attention it's a toy app and so check for errors and security 
 holes before use the code in production.

 I reused the code for a message system between server and client to 
 communicate database tables change. 

 After you Installed the app,  access 
 http://localhost:8000/SSE_clock/default/sse to view the clock example


 Il giorno domenica 9 settembre 2012 12:00:53 UTC+2, smoggy ha scritto:

 Stream Updates with Server-Sent Events: 

 Are like websockets but unidirectional, from the server to the client. 
 Most modern browsers support it. 

 It can be combined with XmlHttpRequest / ajax if the client needs to 
 send events to the server, i.e. emulate websockets. 

 From https://github.com/rwldrn/jquery.eventsource: 
 Q. why use EventSource rather than Websockets? 
 A. EventSource is easier to setup on server (uses http), lighter and 
 most of the times - that's what you acually need. (via temp01) 

 Other resources: 

 Discussions: 
 http://www.html5rocks.com/en/tutorials/eventsource/basics/ 

 http://www.prodigyproductionsllc.com/articles/programming/javascript/avoid-using-eventsource-server-sent-events/
  

 A JS library: https://github.com/Yaffle/EventSource 
 Implemetation on python2/3: https://github.com/niwibe/sse.git 
 DJango implementation: https://github.com/niwibe/django-sse.git 



--