Skip to content
This repository was archived by the owner on Mar 5, 2020. It is now read-only.
This repository was archived by the owner on Mar 5, 2020. It is now read-only.

Suggestion: Raise a ValueError exception if receive()'s "channels" argument is not of type "list". #8

@danielniccoli

Description

@danielniccoli

Yes, I should have read the documentation more carefully, especially the part where it says

receive(channels, block=False), a callable that takes a list of channel names as unicode strings […]*

It was also tempting to write

channel_layer.send("my_channel", {"text": "Hello"})
channel_layer.receive("my_channel")

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions