invisibleroads / invisibleroads/socketIO-client

Namespace Standard Events not firing

Open
#149 8 comments 7 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
441
Forks
204
PR merge metrics
No merged PRs in 30d

Description

According to the documentation it would seem that the following

```
class Namespace(BaseNamespace):
def on_connect(self):
print('[Connected]')
...

socketIO = SocketIO('localhost', 8000, Namespace)
socketIO.wait(seconds=1)
```
ought to fire the `on_connect` callback for the root namespace, however I'm not seeing this behavior. I see the following outputted:
```
dwalker@host:/src › python client.py
DEBUG:socketIO-client:127.0.0.1:8000/socket.io [engine.io transport selected] websocket
DEBUG:socketIO-client:127.0.0.1:8000/socket.io [engine.io heartbeat reset]
```

However, if I change the code to use the .define() we do see the on_connect called for a given new namespace

```
socketIO = SocketIO('http://127.0.0.1', 8000)
socketIO.define(Namespace, '/ns')
```
we get the following
```
dwalker@host:/src › python client.py
DEBUG:socketIO-client:127.0.0.1:5000/socket.io [engine.io transport selected] websocket
DEBUG:socketIO-client:127.0.0.1:5000/socket.io [engine.io heartbeat reset]
DEBUG:socketIO-client:127.0.0.1:5000/socket.io [socket.io packet sent] 0/ns,
DEBUG:socketIO-client:127.0.0.1:5000/socket.io /ns [socket.io waiting for connection]
DEBUG:socketIO-client:127.0.0.1:5000/socket.io /ns [socket.io waiting for connection]
DEBUG:socketIO-client:127.0.0.1:5000/socket.io [socket.io packet received] b'0/ns'
[Connected]
```

Am I missing something with the documentation, or should the root Namesapce also be getting to the on_connect callback?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.