This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Django SSE wrapper is an easy way to implement Server-Sent Events in a Django application. You can find details about SSE at http://www.html5rocks.com/en/tutorials/eventsource/basics/

Installation

Installing from PyPI:

$ pip install django-sse-wrapper

Usage

Django SSE Wrapper exposes a view called EventStreamView that implements the SSE logic. In your urls.py you will specify a pattern like:

from django.conf.urls import patterns, url

from sse_wrapper.views import EventStreamView


urlpatterns = patterns(
    '',
    url(r'^an-event-stream/$',
        EventStreamView.as_view(channel='some-channel-name'),
        name='an_event_stream'),
)

You can also specify a channel extension. This may be useful, for example, when you have an event stream called course_state_stream, but that needs to differ from one course to another (by course_id, for example). The url pattern would look like:

from django.conf.urls import patterns, url

from sse_wrapper.views import EventStreamView


urlpatterns = patterns(
    '',
    url(r'^course-state-stream/(?P<channel_extension>[\w]+)/$',
        EventStreamView.as_view(channel='course-state'),
        name='course_state_stream'),
)

Brokers

For now, I only support two backend brokers: Memory (testing purpose only) and Redis. Soon I’ll be adding support to RabbitMQ, ZeroMQ, and others.

In your settings.py you must specify the broker and its properties:

SSE_BACKEND_CLASS = 'sse_wrapper.backends.redis_based.RedisBasedBackend'
SSE_BACKEND_CONNECTION_SETTINGS = {
    'host': 'localhost',
    'port': 6379,
    'db': 0,
}

Production Environment Notes

Because Server-Sent Events are streams of data, they require long-lived connections. You’ll want to use a server can handle large numbers of simultaneous connections. I strongly recomend you to use some gevent WSGI server.

Contributing

Install Vagrant in order to run the example app and test the code.

License

BSD License

Note: this project is based on django-sse written by niwibe. The reason I started a new project instead of forking is that I decided to change the whole design of the code. I like the idea of omitting the broker from the app code, this way when you decide to change from one broker to another, you just have to change your settings.py.

Release History

Release History

0.0.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-sse-wrapper-0.0.4.tar.gz (4.5 kB) Copy SHA256 Checksum SHA256 Source May 11, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting