-
Notifications
You must be signed in to change notification settings - Fork 13
Suggestion: Raise a ValueError exception if receive()'s "channels" argument is not of type "list". #8
Comments
Yes, this would be a sensible thing to check for. The base |
@andrewgodwin should assertion error be raised here like this ? |
That would work, alternately make this (https://github.com/django/asgiref/blob/master/asgiref/base_layer.py#L104) have a version that validates multiple channels as a list. |
@andrewgodwin list version validation method added django/asgiref#8 |
Thanks, I've merged that in. I'll need to do a new asgiref release before a change can be landed for this as the dependency needs changing. |
@andrewgodwin Cool. |
Not really - the asgiref implementation of |
Yes, I should have read the documentation more carefully, especially the part where it says
It was also tempting to write
and pass a string to the receive method instead of a list, just as in the send() method
Took me a moment to figure out why I wouldn't receive any messages. In asgi_ipc.py#L67 the
channels
argument is passed to list() and therefore I was listening to a number of channels, but not to what I thought I were listening.My suggestion is to raise a ValueError exception if the
channels
argument is not of type "list". Makes debugging a little quicker for those who happen to have overlooked that part in the docs.* Source: https://channels.readthedocs.io/en/latest/asgi.html
The text was updated successfully, but these errors were encountered: