o
    Qh                     @   sT   d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm	Z	 G dd deZ
dS )    N)AsyncJsonWebsocketConsumer)sync_to_async)apps)	Paginatorc                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
NotificationConsumerc                    s4   | j d| jI d H  |  I d H  td d S )Nnotificationsznotification service started)channel_layer	group_addchannel_nameacceptlogginginfoself r   9/var/www/html/Testing_prj/Navya-Bakers/orders/consumer.pyconnect   s
   
zNotificationConsumer.connectc                    s   | j d| jI d H  d S )Nr   )r   group_discardr
   r   r   r   r   
disconnect   s   zNotificationConsumer.disconnectc                    s   | j tddidI d H S )Nmessagehello	text_datasendjsondumps)r   r   r   r   r   receive   s   zNotificationConsumer.receivec                    s,   | j t|d |d ddI d H  d S )Ntyper   )r   r   r   r   )r   eventr   r   r   send_notification   s
   z&NotificationConsumer.send_notificationN)__name__
__module____qualname__r   r   r   r    r   r   r   r   r      s
    r   )r   r   channels.generic.websocketr   asgiref.syncr   django.appsr   django.core.paginatorr   r   r   r   r   r   <module>   s    