Git Product home page Git Product logo

Comments (7)

wuzuf avatar wuzuf commented on July 20, 2024

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.

from gevent-socketio.

jewishop avatar jewishop commented on July 20, 2024

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:

    # Parse request URL and QUERY_STRING and do handshake
    if request_tokens:
        request_tokens = request_tokens.groupdict()
    else:
        handshake_tokens = self.RE_HANDSHAKE_URL.match(path)

        if handshake_tokens:
            return self._do_handshake(handshake_tokens.groupdict())
        else:
            # This is no socket.io request. Let the WSGI app handle it.
            return super(SocketIOHandler, self).handle_one_response()

then handshake_tokens are false and therefore it considers it as a non socket.io request... What am I doing wrong?

from gevent-socketio.

wuzuf avatar wuzuf commented on July 20, 2024

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
Which version of socket.io client are you using? I am quite new to socket.io, maybe the protocol changed. All the tests I did were with socketio 0.9.6. If you want a django app example, there is one in gevent-socketio/examples/django_chat.

from gevent-socketio.

sontek avatar sontek commented on July 20, 2024

@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.

from gevent-socketio.

abulte avatar abulte commented on July 20, 2024

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 ?

Traceback (most recent call last):
File "chat.py", line 154, in socketio
socketio_manage(request.environ, {'/chat': ChatNamespace}, request)
File "/home/alexandre/pyenv_socketio/local/lib/python2.7/site-packages/socketio/init.py", line 60, in socketio_manage
socket = environ['socketio']
KeyError: 'socketio'

from gevent-socketio.

sontek avatar sontek commented on July 20, 2024

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

from gevent-socketio.

abulte avatar abulte commented on July 20, 2024

You're right, I was not running it the right way :-/ I was using python chat.py instead of python run.py. Working good now, thanks !

from gevent-socketio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.