Can't send files to ChatConsumer in Django Channels

I'm having an issue with sending files to a handler in ChatConsumer using Django Channels. I have two consumers, ChatConsumer and GroupChatConsumer, for handling direct messages and group messages. I want to send files to ChatConsumer or GroupChatConsumer based on whether a group exists or not. If the group doesn't exist then file should go to ChatConsumer I'm sending the files using channel_layer.group_send through views. Keep in mind I have the same handler name in ChatConsumer and GroupConsumer but despite changing those the issue persists

What i have tried:

Added print statements right after group_send to confirm if they execute without any error and they do!

I also added logging inside ChatConsumer to see if any file or message is recived but there isn't!

Ensured if the websocket connections are active and they are!

So how can I verify if a message is successfully sent to ChatConsumer? Why is the consumer not receiving any messages?

My code: https://github.com/Kioshi5581/djchat

Back to Top