Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Server Sent Events protocol implemetation.

Project description

Server Sent Events protocol implemetation on python2 and python3 in the same codebase.

Python tested versions:

  • Python 2.7.x
  • Python 3.2.x
  • PyPy 1.9.0r

Api documentation:


Constructor. On this method is called, automaticali initialize the internal buffer with retry statement with 2000ms as default value.


Method for set a custom retry value on initialized Sse intance.


The specification of sse indicates that you can put ids to events. For more info, see:

With this method, can set or reset the id value.


Helper method for reseting event id.

Sse.add_message(event, text, encoding='utf-8')

Method for add messages to the buffer and associate this messages to events. The event parameter can be a unicode string and text can be string, list, tuple or set.


Clears the internal buffer.


Returns a raw output of buffer, ready for set to client. NOTE: this method will be used only on python3.


Returns a raw output of buffer. Same as __str__ but returns unicode value on python2. Is not used on python3.

Aditional info:

  • Sse instance object can be used as iterator. On finish the iteration the internal buffer is automaticaly cleared.
  • Can use dynamic methods Sse.add_event_eventname(text='foo') as alias of Sse.add_message('eventname', 'foo')


BSD License

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sse, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size sse-1.0.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page