{"action":"created","issue":{"url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/88","labels_url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/88/comments","events_url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/88/events","html_url":"https://github.com/miguelgrinberg/Flask-SocketIO/issues/88","id":53877224,"number":88,"title":"Gevent/SocketIO and SSL, EOF occurred in violation of protocol","user":{"login":"JanBenes","id":5049955,"avatar_url":"https://avatars.githubusercontent.com/u/5049955?v=3","gravatar_id":"","url":"https://api.github.com/users/JanBenes","html_url":"https://github.com/JanBenes","followers_url":"https://api.github.com/users/JanBenes/followers","following_url":"https://api.github.com/users/JanBenes/following{/other_user}","gists_url":"https://api.github.com/users/JanBenes/gists{/gist_id}","starred_url":"https://api.github.com/users/JanBenes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanBenes/subscriptions","organizations_url":"https://api.github.com/users/JanBenes/orgs","repos_url":"https://api.github.com/users/JanBenes/repos","events_url":"https://api.github.com/users/JanBenes/events{/privacy}","received_events_url":"https://api.github.com/users/JanBenes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-09T15:12:47Z","updated_at":"2015-01-12T13:51:29Z","closed_at":null,"body":"Hi,\r\n\r\nLet me preface this by saying that I understand that this is probably a gevent issue, not a SocketIO issue in and of itself. I still hope to be able to be able to get some help here, as it is still SocketIO relevant and I believe someone here has to had have and issue with this at some point in a similar context.\r\n\r\nI'm trying to use **SSL** in my **SocketIO** enabled app like this:\r\n\r\n```\r\nsocketio.run(app, host='127.0.0.1',port=12344, keyfile=key_file, certfile=certificate_file)\r\n```\r\n\r\nmy **certificates work**, as verified in a plain Flask app. My dummy **page loads fine**, but about 15 seconds later, I get the following exception:\r\n\r\n```\r\n127.0.0.1 - - [2015-01-09 15:59:46] \"GET / HTTP/1.1\" 200 118 0.002000\r\nTraceback (most recent call last):\r\n  File \"SOMEPATH\\lib\\site-packages\\gevent\\greenlet.py\", line 327, in run\r\n    result = self._run(*self.args, **self.kwargs)\r\n  File \"SOMEPATH\\lib\\site-packages\\gevent\\server.py\", line 102, in wrap_socket_and_handle\r\n    ssl_socket = self.wrap_socket(client_socket, **self.ssl_args)\r\n  File \"SOMEPATH\\lib\\site-packages\\gevent\\ssl.py\", line 383, in wrap_socket\r\n    ciphers=ciphers)\r\n  File \"SOMEPATH\\lib\\site-packages\\gevent\\ssl.py\", line 94, in __init__\r\n    self.do_handshake()\r\n  File \"SOMEPATH\\lib\\site-packages\\gevent\\ssl.py\", line 305, in do_handshake\r\n    return self._sslobj.do_handshake()\r\nSSLError: [Errno 8] _ssl.c:510: EOF occurred in violation of protocol\r\n<Greenlet at 0x5a8d940: <bound method SocketIOServer.wrap_socket_and_handle of <SocketIOServer at 0x5a957f0 fileno=864 address=127.0.0.1:12344>>(<socket at 0x5ae1a90 fileno=1060 sock=127.0.0.1:12, ('127.0.0.1', 57003))> failed with SSLError\r\n```\r\n\r\nI've tried looking it up, but the things I found mostly relate to using urllib or other libraries, e.g. http://stackoverflow.com/questions/16748994/python-ssl-connection-eof-occurred-in-violation-of-protocol. I have tried looking for similar fixed for WGSI, but couldn't find a flag to set the SSL protocol version (http://eventlet.net/doc/modules/wsgi.html). *In what way do I need to reconfigure my app for this to stop happening*?\r\n\r\n**MWE**:\r\n```\r\nimport os\r\nfrom flask import Flask\r\nfrom flask_socketio import SocketIO\r\n\r\n# initialize\r\napp = Flask(__name__)\r\nsocketio = SocketIO(app)\r\n\r\nfrom gevent import monkey\r\nmonkey.patch_all()\r\n\r\nkey_file = 'certs/server.key'\r\ncertificate_file = 'certs/server.crt'\r\n\r\n@app.route('/')\r\ndef main():\r\n    return 'hi!'\r\n\r\nprint 'Serving..'\r\nsocketio.run(app, host='127.0.0.1',port=12344, keyfile=key_file, certfile=certificate_file)\r\n```\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/comments/69571967","html_url":"https://github.com/miguelgrinberg/Flask-SocketIO/issues/88#issuecomment-69571967","issue_url":"https://api.github.com/repos/miguelgrinberg/Flask-SocketIO/issues/88","id":69571967,"user":{"login":"JanBenes","id":5049955,"avatar_url":"https://avatars.githubusercontent.com/u/5049955?v=3","gravatar_id":"","url":"https://api.github.com/users/JanBenes","html_url":"https://github.com/JanBenes","followers_url":"https://api.github.com/users/JanBenes/followers","following_url":"https://api.github.com/users/JanBenes/following{/other_user}","gists_url":"https://api.github.com/users/JanBenes/gists{/gist_id}","starred_url":"https://api.github.com/users/JanBenes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanBenes/subscriptions","organizations_url":"https://api.github.com/users/JanBenes/orgs","repos_url":"https://api.github.com/users/JanBenes/repos","events_url":"https://api.github.com/users/JanBenes/events{/privacy}","received_events_url":"https://api.github.com/users/JanBenes/received_events","type":"User","site_admin":false},"created_at":"2015-01-12T13:51:29Z","updated_at":"2015-01-12T13:51:29Z","body":"By \"terminate SSL connections\", I assume you mean \"translate them into non-SSL connections that are then relayed to the application\"?\r\n\r\nI have tried building a simple ``WSGIServer``-based example and it turns out I still run into the same problems then. For future reference, here's a link to my StackOverflow question: http://stackoverflow.com/questions/27903447/gevent-and-ssl-cause-eof-occurred-in-violation-of-protocol"}}