Server-Sent Events for Django

56 views
Skip to first unread message

Justin Karneges

unread,
Jun 13, 2018, 7:34:21 PM6/13/18
to django-users
Hi folks,

I'm pleased to announce an SSE library for Django:

The library makes pushing data from the server really easy. It uses Channels under the hood, although you don't have to write any async code. Simply declare endpoints in routing.py and call send_event() from anywhere.

I hope others find it useful.

Justin

Jason

unread,
Jun 13, 2018, 8:20:18 PM6/13/18
to Django users
Nice library!  good work :-)

I would suggest you update your readme to reflect that SSE is not supported by any MS browser (IE or Edge) as shown by https://caniuse.com/#feat=eventsource.  

Justin Karneges

unread,
Jun 13, 2018, 9:20:44 PM6/13/18
to django-users
Thanks Jason! The library comes with Yaffle's polyfill for IE/Edge support, that can be included with a template tag.

Jason

unread,
Jun 13, 2018, 10:45:55 PM6/13/18
to Django users
ooh, nice!  missed that part.

Did you consider having that pull from a CDN rather than locally?  Reason being, any updates to said polyfills will require you to deploy an update.  Whereas if you have a template tag to pull from a CDN, you can have your users specify the version if necessary and pull the latest by default.  Would be one less thing you have to worry about maintaining.  


Also, what's the reason for having json2 in the static files?  https://github.com/douglascrockford/JSON-js even states

On current browsers, this file does nothing, preferring the built-in JSON object. There is no reason to use this file unless fate compels you to support IE8, which is something that no one should ever have to do again.

Other than that, the lib looks pretty good to me.  </thumbs-up>

Justin Karneges

unread,
Jun 13, 2018, 11:14:29 PM6/13/18
to django-users
Thanks for the tips.

I didn't think about referencing a CDN, but I suppose that's a better default, and if people want local copies then they can make their own.

Json2 probably shouldn't be in there. I've been dragging that file around for years without really thinking about it. If anyone really needs to support old IE they should know to include it themselves.

Justin
Reply all
Reply to author
Forward
0 new messages