tag:blogger.com,1999:blog-18508356.post8959751758448069625..comments2026-02-13T11:24:21.556-05:00Comments on Just a little Python: Gevent, ZeroMQ, WebSockets, and Flot FTW!Rick Copelandhttp://www.blogger.com/profile/11612114223288841087noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-18508356.post-58134376130009507092013-01-23T10:00:45.595-05:002013-01-23T10:00:45.595-05:00Great news! Thanks for sharing this!Great news! Thanks for sharing this!Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-88841134424105634182013-01-23T03:48:00.126-05:002013-01-23T03:48:00.126-05:00> you'll need to have libzmq-dev 2.1+
This...> you'll need to have libzmq-dev 2.1+<br /><br />This is no longer true for pyzmq 2.2. See http://pypi.python.org/pypi/pyzmq-static/2.2Jenshttps://www.blogger.com/profile/11369629401245294938noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-89555195254447560272013-01-20T21:36:37.416-05:002013-01-20T21:36:37.416-05:00IvanZ - thanks for the comment. One of the reasons...IvanZ - thanks for the comment. One of the reasons I had the producer going over the network, if I recall correctly, was to imagine how one would 'scale out' such a solution to run on multiple servers. In this case, it's certainly a case of over-architecting the solution, however.Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-78886864237781506102013-01-19T06:19:37.151-05:002013-01-19T06:19:37.151-05:00But server can be removed if producer publishes di...But server can be removed if producer publishes directly to inproc:IvanZhttps://www.blogger.com/profile/11242179064607227896noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-24705647284428887552012-12-06T13:32:18.886-05:002012-12-06T13:32:18.886-05:00Hi Anonymous ;-)
Thanks for the comment. One appr...Hi Anonymous ;-)<br /><br />Thanks for the comment. One approach to getting a session ID is having the server send a user id to the browser on connect (or vice-versa) and storing it. So you'd have a 'sessionid' message or something like that which you would emit() from the server, listening for that event in JS. <br /><br />You might also want to check out http://blog.pythonisito.com/2012/07/realtime-web-chat-with-socketio-and.html for a tutorial on a more-recent version of socket.io.<br /><br />Thanks again!Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-69124198042706179352012-12-05T08:06:24.925-05:002012-12-05T08:06:24.925-05:00Hi Rick,
Thanks for the post.
How can I get the ...Hi Rick,<br /><br />Thanks for the post. <br />How can I get the session ID of a connection (user) when the connection established to the web socket, from JS code?<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18508356.post-44098573147528557522012-07-29T19:59:14.629-04:002012-07-29T19:59:14.629-04:00Thanks for taking the time to work through this, a...Thanks for taking the time to work through this, and thanks for the comment!Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-40828531520100901562012-07-29T16:33:46.218-04:002012-07-29T16:33:46.218-04:00I can tell you why you did that, having used this ...I can tell you why you did that, having used this article as a base for my own work.<br /><br />If you attempt multiple zmq connections to the same TCP endpoint within the same process, they will fail with an "address already in use" error.<br /><br />So this must be why you stuck the "inproc://queue" hop in there. I tried to take it out and hit the problem I just mentioned, so have reinstated it and now everything works like a charm :)<br /><br />Thanks for the article. Very useful.Mattnoreply@blogger.comtag:blogger.com,1999:blog-18508356.post-33126677189559403132012-07-12T10:32:18.722-04:002012-07-12T10:32:18.722-04:00My guess is that somehow you're running either...My guess is that somehow you're running either a) with different versions of packages that I used, or b) without the correct WSGI server. I am planning on a new blog post covering the latest version of socket.io in the near future, so stay tuned!Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-39494147570183723522012-07-11T19:05:26.806-04:002012-07-11T19:05:26.806-04:00Hi Rick.
The websocket example above works fine, ...Hi Rick.<br /><br />The websocket example above works fine, but when I try to run the socketio example I get an KeyError: 'socketio' on line 61 ("socketio = environ['socketio']"). This happens on both the Windows and the Ubuntu platform. Can you please help me resolve this issue since I have no clue how to fix it.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18508356.post-72239004200104637002012-06-06T17:25:47.428-04:002012-06-06T17:25:47.428-04:00Thanks for the question! Honestly, it's been s...Thanks for the question! Honestly, it's been several months since I looked at this code and I don't know why I did that, either. The WebSocketApp *should* be able to directly subscribe to port 5000, I think.Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-23021557925809491022012-06-06T17:04:15.671-04:002012-06-06T17:04:15.671-04:00Why do we need zmq_server() to retransmit the mess...Why do we need zmq_server() to retransmit the messages. Can't we just connect the socket in WebSocketApp to tcp://*:5000?Daniel Velkovhttps://www.blogger.com/profile/00869107965007965693noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-16567199598566923802011-07-28T22:16:33.776-04:002011-07-28T22:16:33.776-04:00By the way, I've put the working code up on my...By the way, I've put the working code up on my SourceForge homepage http://sf.net/u/rick446/gevent-socketio/ if you'd like to clone it from there. The latest version uses socket.io instead of "raw" websockets for more portability. I'll try to write that up soon.Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-24210042566459238852011-07-25T10:23:10.303-04:002011-07-25T10:23:10.303-04:00Thanks for the comments!
@CD Simpson: I did very ...Thanks for the comments!<br /><br />@CD Simpson: I did very little investigation of the other long-polling options. I will probably be looking into socket.io that @Klaus Lönze mentioned (there's a gevent-socketio package) and doing another post. I believe that socketio will do all sorts of graceful degradation even down to flash based on your browser.<br /><br />@Hridas: I've done some things with RabbitMQ for our work on Allura (http://sf.net/p/allura). RabbitMQ is nice, but as I mentioned, it requires a broker and it's quite a bit more complex to get set up. I believe there are some browser-side integrations with RabbitMQ (google for Stomp RabbitMQ), but I've never used them.Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-55404469727636613922011-07-25T06:07:18.741-04:002011-07-25T06:07:18.741-04:00Nice integration.
I'm looking for the simila...Nice integration. <br /><br />I'm looking for the similar integration with RabbitMQ for a while, But I didn't got one. Any way your post helped me to get an Idea about 0MQ features. The socket handling was very nice, RabbitMQ missing that part I think ...:(<br /><br />If you have any Idea about RabbiMQ please share.<br /><br />Thank you,<br />Haridas N.Haridas Nhttps://www.blogger.com/profile/09370400068730311354noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-75427514467350586302011-07-24T04:45:01.807-04:002011-07-24T04:45:01.807-04:00You prolly know this one already, but I recommend ...You prolly know this one already, but I recommend http://socket.io/ for a cross-browser websocket implementation.Klaus Lönzenoreply@blogger.comtag:blogger.com,1999:blog-18508356.post-32638952291215871392011-07-24T03:48:55.974-04:002011-07-24T03:48:55.974-04:00As somebody that has been fighting WebSockets for ...As somebody that has been fighting WebSockets for the past few months, I'm curious: Have you investigated other long-polling options, like Comet, Athena, Minerva, etc.?Corbin Simpsonhttps://www.blogger.com/profile/04637041273744009562noreply@blogger.comtag:blogger.com,1999:blog-18508356.post-22110149558483131042011-07-23T18:45:01.965-04:002011-07-23T18:45:01.965-04:00I should point out that this was tested in Chrome ...I should point out that this was tested in Chrome only; I know that Firefox and Opera disabled WebSockets. YMMV.Rick Copelandhttps://www.blogger.com/profile/11612114223288841087noreply@blogger.com