New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
socketio does not exist in request.environ dictionary #79
Comments
Can you please provide an example? Note that the request.environ dict is updated only here: https://github.com/abourget/gevent-socketio/blob/master/socketio/handler.py#L118. So, after the handshake, for example. |
Thanks for the answer. After debugging a bit, I see that when I get a websocket request from the client (this is the client code: https://github.com/codysoyland/django-socketio-example/blob/master/templates/chat.html) then the PATH_INFO value is "/socket.io/websocket/". So when the following conditions are checked:
then handshake_tokens are false and therefore it considers it as a non socket.io request... What am I doing wrong? |
Without having the server code to reproduce, it will be hard for me to help. When I use websocket transport, here is the path: http://localhost:8000/socket.io/1/websocket/213871869224 |
@jewishop Closing this since you haven't responded but feel free to re-issue f you are still having problems and we can help you get it fixed. |
Hi, I'm getting the same problem with both my custom Flask app and the Flask chat example included (cloned from master today). Socket.io.js is 0.9.6. Any clues ?
|
Usually this means you ran it with a server that wasn't using a SocketIO worker. How are you running the app? Also, are you sure it was using the latest gevente-socketio package? The requirements.txt had a pegged gevent-socketio version |
You're right, I was not running it the right way :-/ I was using |
I am using gunicorn with a socketio.sgunicorn.GeventSocketIOWorker worker to run a django project.
When a websocket request arrives, the "socketio" key does not appear in the request.environ dictionary. What can be the reason for that?
The request.environ dictionary:
{'HTTP_COOKIE': 'csrftoken=ou3ptkud0jYBsJ9hKVmQfhQVcI2a9Xiu; sessionid=3cccb6f0e3a18dac0a4b53f9880eea3d', 'SERVER_SOFTWARE': 'gevent/0.13 Python/2.7', 'SCRIPT_NAME': u'', 'REQUEST_METHOD': 'GET', 'PATH_INFO': u'/socket.io/websocket', 'HTTP_ORIGIN': 'http://127.0.0.1:8000', 'SERVER_PROTOCOL': 'HTTP/1.0', 'QUERY_STRING': '', 'HTTP_SEC_WEBSOCKET_EXTENSIONS': 'x-webkit-deflate-frame', 'HTTP_CONNECTION': 'Upgrade', 'SERVER_NAME': 'localhost', 'REMOTE_ADDR': '127.0.0.1', 'wsgi.url_scheme': 'http', 'SERVER_PORT': '8000', 'HTTP_UPGRADE': 'websocket', 'wsgi.input': <gevent.pywsgi.Input object at 0x8da33ec>, 'HTTP_HOST': '127.0.0.1:8000', 'wsgi.multithread': False, 'HTTP_SEC_WEBSOCKET_VERSION': '13', 'wsgi.version': (1, 0), 'GATEWAY_INTERFACE': 'CGI/1.1', 'wsgi.run_once': False, 'wsgi.errors': <open file '', mode 'w' at 0xb74db0d0>, 'wsgi.multiprocess': False, 'HTTP_SEC_WEBSOCKET_KEY': 'PYVCqrOJSn1N90lN0igPuA==', 'CSRF_COOKIE': 'ou3ptkud0jYBsJ9hKVmQfhQVcI2a9Xiu'}
The text was updated successfully, but these errors were encountered: