Realtime server pushes

175 views
Skip to first unread message

Mathieu Drapeau

unread,
Aug 4, 2014, 11:07:45 AM8/4/14
to pylons-...@googlegroups.com
It seems there is few current possibilities to do realtime server pushes using different libs (gevent-socketio, pyramid_sockjs, pyramid_socketio).
Some of them are deprecated and it seems that gevent-socketio hasn't been updated for several months and doesn't support socketio 1.0 yet.

What are you suggesting to use for realtime pushes using pyramid?
Found that autobahn uses websocket on top of asyncio (http://autobahn.ws/python/), wondering if it could be easily integrated with pyramid?

thanks

Blaise Laflamme

unread,
Aug 4, 2014, 2:15:38 PM8/4/14
to pylons-...@googlegroups.com
Hi Mathieu,

if you're looking at server push only, and not bi-directional channel communication, SSE could be a good and simple alternative?

Mathieu Drapeau

unread,
Aug 4, 2014, 2:47:33 PM8/4/14
to pylons-...@googlegroups.com
Hey Blaise, thanks for your response!! :)
Good point... SSE should be enough to handle most of my use cases.

John Anderson

unread,
Aug 16, 2014, 2:17:42 PM8/16/14
to pylons-...@googlegroups.com
You want to be careful when using Server Side Events (SSE) they are not a very good alternative to WebSockets or Comet if you are expecting to build a service for an unknown user base.  SSE is not supported in even the latest Internet Explorer browsers and if you can't guarantee your users wont have IE then using something like sockjs or socket.io would be a better alternative since they support multiple transports so that they will work in all browsers.


--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To post to this group, send email to pylons-...@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Mathieu Drapeau

unread,
Aug 22, 2014, 1:01:50 PM8/22/14
to pylons-...@googlegroups.com
Sontek, you are right... I did spent too much time already trying to make this work using SSE as I used to do with websockets!
It appears, I have no easy way to stop the stream from server side, the browser keeps hammering the server whatever I am trying. Plus debugging SSE is painfull, you cannot inspect response from the browser. Support for SSE in browsers is also horrible.

On the other hand, there isn't any much options left with pyramid integration (either with sockjs or socket.io)... Most of projects seemed to be abandoned...

Sontek, what is the latest stack you have been using for realtime pushes?

Laurence Rowe

unread,
Aug 24, 2014, 11:14:45 PM8/24/14
to pylons-...@googlegroups.com
I wouldn't worry too much about specific Pyramid integration in selecting your solution here. WSGI application frameworks like Pyramid map WSGI requests to handlers, so are pretty much irrelevant for websocket or server sent events (and a poor fit even for long polling.) These protocols need server-level support, and you will most likely also want a pub-sub server of some description to act as the message hub. The WSGI app's interaction will then be limited to posting messages to the relevant pub-sub channel. (If you are using pyramid_tm you should probably make posts to the pub-sub channels transaction aware, similar to pyramid_mailer, to avoid duplicates on transaction retries.)

A previous project I worked on used XMPP / ejabberd for pub-sub (along with Strophe.js,) but I think nowadays I'd probably lean towards Redis as the websocket server can simply forward on every Redis subscription notification to the web client. If you want to stick to Python then autobahn looks like a reasonable option (websocket support hasn't yet landed in core Twisted yet) but I'd also consider Nginx / Openresty.

Laurence
Reply all
Reply to author
Forward
0 new messages