SocketIO + gevent_socketio (django)

I just figured out how to make this work and figured I’d share in the hopes that it may save some others from having to dig through the bowels of the gevent_socketio package.

gevent_socketio requires a trailing / in the handshake url which the cocos library does not provide. To fix this just go to socketio/handler.py and update SocketIOHandler.RE_HANDLHAKE_URL. Ensure you are updating the handler.py that is actually in use (There was a handler.py one in gevent_socketio but it was the one in socketio that was actually used).

RE_HANDSHAKE_URL = re.compile(r"^/(?P<resource>.+?)/1/$", re.X)

becomes
RE_HANDSHAKE_URL = re.compile(r"^/(?P.+?)/1/?$", re.X)

That’s it. Once I found that one character the connection went through nice and easy. Also, you can just append namespaces onto the end of the connect url and they work properly.

_client = SocketIO::connect(*this, “http://127.0.0.1:9000/battle”);