Skip to content
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

None of the signals in django_socketio.events fire, ever #45

Open
ghost opened this issue Apr 9, 2013 · 1 comment
Open

None of the signals in django_socketio.events fire, ever #45

ghost opened this issue Apr 9, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 9, 2013

I've setup the libraries as instructed (installed the Ubuntu dependencies, installed django_socketio via PIP, added in the URLconf, put django_socketio into my settings.py's INSTALLED_APPS and run manage.py collectstatic). I'm not a Django notice and I've worked with socket.io before, but I'm utterly stumped!

Client-side things seem to be OK: a socket connection is established and the connect event is called; same for `disconnect, however no events fire at all on the server side.

In my models.py file, I've hooked up a function to the on_connect, on_subscribe and on_message events and none of them run (I've discovered this by setting up logging. A log entry is written and output to the console that confirms the code is being run that hooks up the events, but nothing ever happens when the events take place).

Is this an issue with latter versions of the Websockets protocol as mentioned in your docs? I'm running the socket server as sudo (tried in daemon and shell mode), but I get nothing either way.

Any ideas?
Thanks!

@frenchtoast747
Copy link

I've had the same problem. I believe the problem is a bug in django-socketio when there isn't a channel supplied to the decorator.

In views.py Line 38:
https://github.com/stephenmcd/django-socketio/blob/master/django_socketio/views.py#L38
The socket subscribes to a channel and then calls the on_subscribe callback handler. The problem is that in events.py on Line 65:
https://github.com/stephenmcd/django-socketio/blob/master/django_socketio/events.py#L65
there is a check not socket.channels. Well, we just subscribed to a channel, so that will always return False. If there isn't a channel pattern given ( i.e. the default decorator ), then no_channel will always be False and the handler will never get called at Line 71, events.py. I'm really not even certain that the no_channel variable needs to be there. It seems to me that the check for socket.channel comes later on anyway on Line 69 in events.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant