https://github.com/nh2/eventstreamexamples
Example Turbogears project for implementing server-side events in Python
https://github.com/nh2/eventstreamexamples
Last synced: about 1 month ago
JSON representation
Example Turbogears project for implementing server-side events in Python
- Host: GitHub
- URL: https://github.com/nh2/eventstreamexamples
- Owner: nh2
- License: other
- Created: 2011-01-17T15:34:31.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-01-17T15:36:24.000Z (over 14 years ago)
- Last Synced: 2025-04-09T04:22:42.666Z (2 months ago)
- Language: Python
- Homepage:
- Size: 88.9 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
This is an example Turbogears project to show how to implement server-side events (SSE, browsers use it as EventSource) for event streaming.
If you you want to use the controllers in plain Pylons, make sure to get rid of Turbogear's decorators sugar.
There are two example controllers: One for simple event streaming, one for server-side asynchronous stuff using the gevent library.
Installation and Setup
======================Create a virtual Python environment and activate it::
$ virtualenv --no-site-packages -p python2.6 turbogears-eventstream-examples
$ cd turbogears-eventstream-examples
$ source bin/activateClone this project::
$ git clone git://github.com/nh2/eventstreamexamples.git
Install ``eventstreamexamples`` using the setup.py script::
$ cd eventstreamexamples
$ python setup.py installStart the paste http server::
$ paster serve development.ini
Or for the gevent example::
$ paster serve development-gunicorn.ini
While developing you may want the server to reload after changes in package files (or its dependencies) are saved. This can be achieved easily by adding the --reload option, but only works for the non-gevent example::
$ paster serve --reload development.ini
Then you are ready to go.
Thanks to Alexandre Bourget for his blog post about `HTML5's EventSource in Pylons`_... _`HTML5's EventSource in Pylons`: http://blog.abourget.net/2010/6/16/html5-eventsource-in-pylons-read-comet-ajax-polling/