socket.io Web2Py

824 views
Skip to first unread message

Shiv

unread,
Nov 17, 2011, 12:01:30 PM11/17/11
to web...@googlegroups.com
Hi Everyone,

Has any one used the socket.io with web2py, please share your experience.

My requirement is 
On click action, open a socket and run a TCL script and communication with same.
Once the TCL script is done the close the socket. I have to run multiple such TCL script on multiple ports parallel y.

Tried with Gevent,Tornado and struggling little bit. Thought of getting you guys experience also.

Thanks in advance
Shiv

Vasile Ermicioi

unread,
Nov 17, 2011, 12:29:30 PM11/17/11
to web...@googlegroups.com
socket.io is server side javascript that doesn't have anything in common with web2py

António Ramos

unread,
Nov 17, 2011, 12:39:35 PM11/17/11
to web...@googlegroups.com
Hello, i´m trying to work with socket. io in windows and no luck

After that i would try it with web2py but i´m stuck with this example





2011/11/17 Vasile Ermicioi <elf...@gmail.com>

Anthony

unread,
Nov 17, 2011, 1:48:46 PM11/17/11
to web...@googlegroups.com
Here's a three-part blog series on using Tornado, web2py's comet_messaging.py, and Socket.IO for async communication: http://greg.thehellings.com/2011/04/web2py-websockets-and-socket-io-part-i-basic-display/ (link to Part 2 at the bottom).

I suppose gevent-socketio (https://bitbucket.org/Jeffrey/gevent-socketio) could be made to work with web2py as well (apparently works with Django: http://codysoyland.com/2011/feb/6/evented-django-part-one-socketio-and-gevent/).

Anthony

Matt Gorecki

unread,
Nov 17, 2011, 10:31:00 PM11/17/11
to web...@googlegroups.com
I am able to send socket.io events with this code:  https://gist.github.com/1375505

It's based off an answer I found on Stack Overflow.

With the code in that gist, you should be able to send one event to your node.js server.  If you have a long running Python script, you'll need to send heartbeat packets (with sio.heartbeat() ) every 15 seconds or you'll lose your connection to node.js.

This particular example is from a photobooth application I'm working on called PhotoPops.  http://myphotopops.com  There isn't much there right now as I just used it in public for the first time last Friday at a local event.  I think I'll make that Github repo public when I feel a little more confident about it.

Matt Gorecki

Shiv

unread,
Nov 21, 2011, 5:44:55 AM11/21/11
to web...@googlegroups.com
Thanks for sharing Information. 
I have used Tornado, Gevent and socket.io and its working fine.

Best Regards
Shiv
--
Thanks & Regards
Shiv
Reply all
Reply to author
Forward
0 new messages