I am working on ordering system and using django-channels for sending a 
notification to an admin about the order has been placed and it works only 
with 1-2 orders perfectly after that no notification. 


# consumers.py
 from channels import Group
 from channels.sessions import channel_session 
 


 @channel_session
 def ws_connect(message):
    print "Connect"
    message.reply_channel.send({"accept": True})
    Group('admin-channel', channel_layer=message.channel_layer).add(message.
reply_channel) 
 


 @channel_session
 def ws_disconnect(message):
    print "Disconnect"
    Group('admin-channel', channel_layer=message.channel_layer).discard(
message.reply_channel)


# views.py
 def view(request):
        # some order realted processing
    message = {
        "status": "Success",
        "order-id": order.id
    }


    Group('admin-channel').send({
        "text": json.dumps(message)
    })


it stop sending message after 1-2 orders .

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/338f2aaf-bf4f-42f3-9823-bee216448c14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to