how does the class bit work

On Friday, November 25, 2022 at 2:23:15 AM UTC-7 ansarih...@gmail.com wrote:

> [image: Screenshot 2022-11-25 145248.png]
>
> On Friday, November 25, 2022 at 2:47:12 PM UTC+5:30 MD Hassan Ansari wrote:
>
>>
>>    - this is consumers.py
>>
>> class ChatConsumer(AsyncWebsocketConsumer): 
>>                        async def receive(self, text_data):
>>                                           pass 
>>    
>>    - this is my view.py
>>
>> class CreateChatMessageView(APIView): ...
>>                            message_obj = 
>> ChatMessage.objects.create(chat_room=chat_room_obj,                        
>>      sender_id=sender_id, receiver_id=receiver_id, 
>> message_text=message_text, message_attachment=message_attachment) 
>>                                # here I want to call the 'receive' 
>> function from 'ChatConsumer(AsyncWebsocketConsumer):' 
>>                                message_obj.save() ... 
>>    
>>    - I want to call the receive function 
>>    from ChatConsumer(AsyncWebsocketConsumer):.
>>    - How can I have done?
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/d3498f8a-c25b-47a1-a672-1e9b862687c5n%40googlegroups.com.

Reply via email to