django / channels

Developer-friendly asynchrony for Django

Home Page:https://channels.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consumer methods 'channel_layer.send', 'channel_layer.group_send' and 'channel_layer.receive' not working well.

Guidoow opened this issue · comments

Hi everyone. You should keep in mind that my english may be not too well and too that im quite new to the dev world.
12 days ago, i asked help in -Discussions- section, but i didn't achieve to fix this problem. [ github.com//discussions/1931 ]

Aclarations:

  • Im not testing on web, but on dart.
  • I tried with consumer functions that inherit from WebsocketConsumer, SyncConsumer and AsyncConsumer
  • As I understood from reading the docs, the channel_layer.group_send and the channel_layer.send methods adds sent messages to a queue and, if there is a specified "type" key in the sent dictionary, executes a function (named in the key value) for a consumer which is in the specified group and has a persistent connection.
  • This seems to be an error, but it doesn't display anything in the console so i can't put some console log error here.
  • Im completly secure that im using the functions correctly, and i consider non effective to put the code here, anyway, you can go to the above link where i asked before, there i published some.

What i expect:

  • Channel layers sending messages to independent consumers. It can be with the above descripted behaviour (funct execution), and don't matter if there are in a group (channel_layer.group_send) or if i need to send to the channels directly (channel_layer.send), anyone would work for what im building.

What happened:

  • Channel layers only add the messages sended to a queue (either there are sended to a group or to specified channel) but don't send them automatically, neither executes the function, how the documentation describes.
  • Trying to achieve the above functionality, i tried to receiving the messages with channel_layers.receive() and is actually working, BUT when i execute a receive and there are not messages in the queue for that consumer, the server completly stops, and need to be restarted.

May help:

Thanks for read and i appreciate it the help :)

Hi @Guidoow — as per #1931, you really need to provide a minimal reproduce to be able to help you here. Ideally a failing test case. (Screenshots of code are not something I can run 🙂)