cll35 / mplh5canvas

Automatically exported from code.google.com/p/mplh5canvas
0 stars 0 forks source link

websocket replacement #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi 

This is not a bug but I did not find a mailing list for suggestions or general 
questions.

I have been working with matplotlib for quite some time. I have done some 
modifications to the tk and gtk backends mainly to include tabbed figure 
manager and style management (colors, line thickness).
https://github.com/fariza/MPL-Experimental-Backend

I have a small project where it would be perfect to use the mplh5canvas for 
plotting automated test results on a webpage and be able to interact with those 
graphics.

The only problem is the websocket limitation (scarce suport from popular 
browsers).

The question is: How difficult would be to provide an alternative to websockets 
using ajax?
I have been looking at your source code but I got lost pretty soon.
If you could point me in the right direction I can give it a try.

Thanks and sorry for the not a bug issue.
Federico

Original issue reported on code.google.com by ariza.fe...@gmail.com on 5 Dec 2012 at 3:21

GoogleCodeExporter commented 9 years ago
Hi Federico,

Sorry for the slow response!

WebSockets used to be a major pain due to limited browser support but this 
should be less of an issue in July 2013. At this time, all major browsers (IE, 
Firefox, Chrome, Safari, Opera) support the latest RFC 6455 standard. It even 
works on iOS and Android. My gut feel would be to use WebSockets.

If you still feel that you need something more than WebSockets, I would suggest 
looking at Socket.IO, which basically provides a superset of WebSockets for 
older browsers. It will require quite a bit of work...

First you will have to include the Socket.IO client library in base_page.py so 
that it ends up running in the browser (the easy part). Then you need a server 
component that can receive Socket.IO communications to replace the 
functionality of mod_pywebsocket. This can be combined with simple_server.py (a 
basic server that listens on a port and speaks WebSocket), or a fancier HTTP 
server (e.g. Tornado or gevent) that then has to do the work of 
simple_server.py. I would look at gevent paired with gevent-socketio for the 
server side.

Good luck!
Ludwig

Original comment by ludwig.s...@gmail.com on 15 Jul 2013 at 2:48