{"action":"created","issue":{"url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/348","repository_url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO","labels_url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/348/labels{/name}","comments_url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/348/comments","events_url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/348/events","html_url":"https://github.com/miguelgrinberg/Flask-SocketIO/issues/348","id":187474414,"number":348,"title":"doing long operations inside the event handler","user":{"login":"jmrbcu","id":3453822,"avatar_url":"https://avatars.githubusercontent.com/u/3453822?v=3","gravatar_id":"","url":"https://api.github.com/users/jmrbcu","html_url":"https://github.com/jmrbcu","followers_url":"https://api.github.com/users/jmrbcu/followers","following_url":"https://api.github.com/users/jmrbcu/following{/other_user}","gists_url":"https://api.github.com/users/jmrbcu/gists{/gist_id}","starred_url":"https://api.github.com/users/jmrbcu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmrbcu/subscriptions","organizations_url":"https://api.github.com/users/jmrbcu/orgs","repos_url":"https://api.github.com/users/jmrbcu/repos","events_url":"https://api.github.com/users/jmrbcu/events{/privacy}","received_events_url":"https://api.github.com/users/jmrbcu/received_events","type":"User","site_admin":false},"labels":[{"id":79522651,"url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-05T03:40:15Z","updated_at":"2016-11-07T05:07:16Z","closed_at":null,"body":"How to do long operations inside an event handler with Flas-SocketIO, for instance, I notice the following code does not work in every situation. Also, in some cases, messages don't get received on the client side if the handler emitting it does not finish.\r\n```\r\n@socketio.on('test_event')\r\ndef on_test_event():\r\n    c = 0\r\n    while True:\r\n        print 'On the server: {0}'.format(c)\r\n        c += 1\r\n        socketio.sleep(1)\r\n```\r\n\r\nAlso, why do you recommend eventlet over gevent right now?"},"comment":{"url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/comments/258748321","html_url":"https://github.com/miguelgrinberg/Flask-SocketIO/issues/348#issuecomment-258748321","issue_url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/348","id":258748321,"user":{"login":"miguelgrinberg","id":2715854,"avatar_url":"https://avatars.githubusercontent.com/u/2715854?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelgrinberg","html_url":"https://github.com/miguelgrinberg","followers_url":"https://api.github.com/users/miguelgrinberg/followers","following_url":"https://api.github.com/users/miguelgrinberg/following{/other_user}","gists_url":"https://api.github.com/users/miguelgrinberg/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelgrinberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelgrinberg/subscriptions","organizations_url":"https://api.github.com/users/miguelgrinberg/orgs","repos_url":"https://api.github.com/users/miguelgrinberg/repos","events_url":"https://api.github.com/users/miguelgrinberg/events{/privacy}","received_events_url":"https://api.github.com/users/miguelgrinberg/received_events","type":"User","site_admin":false},"created_at":"2016-11-07T05:07:16Z","updated_at":"2016-11-07T05:07:16Z","body":"Can you describe exactly what you mean by \"it does not work\"? Do you get any errors on the clients or on the server? Have you enabled client and server logging specifically for Socket.IO to see if there are any clues there?"}}
{"actor":{"display_login":"miguelgrinberg"}}