Hello! I'm using django channels. I deployed it in IIS 8 and it's work on http.request. But when I try to use websocket result is nothing. Daphne writes me "Websocket incoming frame on websocket.send!toke". Workers write me "Dispatching message on websocket.receive to channels.routing.null_consumer". Say me, please. What i'm doing wrong?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f67d74a0-fb8e-4d7e-abaa-e124befff531%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
redis_host = os.environ.get('REDIS_HOST', 'localhost')
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'asgi_redis.RedisChannelLayer',
'CONFIG': {
'hosts': [(redis_host, 6379)],
},
'ROUTING': 'VoteMagic.routing.channel_routing',
},
}
import os
from channels.asgi import get_channel_layer
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "VoteMagic.settings")
channel_layer = get_channel_layer()
from channels.routing import route
from votes.consumers import ws_message
channel_routing = [
route("http.request", "votes.consumers.http_consumer"),
route("websocket.connect", ws_message),
route("websocket.receive", ws_message),
]
from django.http import HttpResponse
from channels.handler import AsgiHandler
def http_consumer(message):
response = HttpResponse("Hello world! You asked for %s" % message.content['path'])
for chunk in AsgiHandler.encode_response(response):
message.reply_channel.send(chunk)
def ws_message(message):
message.reply_channel.send({
"text": message.content['text'],
})
"Dispatching message on websocket.receive to channels.routing.null_consumer" means that you don't have a consumer tied to the "websocket.receive" channel, so Channels is sending it nowhere. Did you set up your routing correctly?Andrew
On Sat, Feb 4, 2017 at 2:41 AM, Алексей Кузуб <roni...@gmail.com> wrote:
Hello! I'm using django channels. I deployed it in IIS 8 and it's work on http.request. But when I try to use websocket result is nothing. Daphne writes me "Websocket incoming frame on websocket.send!toke". Workers write me "Dispatching message on websocket.receive to channels.routing.null_consumer". Say me, please. What i'm doing wrong?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f8b65128-7d9e-4866-9564-e9fce8699b40%40googlegroups.com.
193.150.110.228:58244 - - [06/Feb/2017:10:42:04] "WSCONNECTING /" - -2017-02-06 10:42:04,709 DEBUG Upgraded connection http.response!hgLdPnoqcAknto WebSocket websocket.send!FlEitltfgsCC2017-02-06 10:42:04,713 DEBUG WebSocket websocket.send!FlEitltfgsCC open andestablished193.150.110.228:58244 - - [06/Feb/2017:10:42:04] "WSCONNECT /" - -2017-02-06 10:42:04,714 DEBUG WebSocket websocket.send!FlEitltfgsCC acceptedby application2017-02-06 10:42:04,709 - DEBUG - worker - Got message on websocket.connect (reply websocket.send!FlEitltfgsCC)2017-02-06 10:42:04,710 - DEBUG - runworker - websocket.connect2017-02-06 10:42:04,711 - DEBUG - worker - Dispatching message on websocket.connect to channels.routing.connect_consumer--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/71618c7e-dbe4-4a76-b873-e35fa410f942%40googlegroups.com.
The errors you're getting both point to Channels not using your second two routes, but I've tried a similar routing locally and it works fine for me. Is there a chance you could make this into a small sample project that reproduces the issue?You could also try clearing any .pyc files or __pycache__ directories to make sure it's not some old code being cached, and making sure there's not a "routing" directory that clashes with routing.pyAndrew
On Sun, Feb 5, 2017 at 11:54 PM, Алексей Кузуб <roni...@gmail.com> wrote:
And workers write me2017-02-06 10:42:04,709 - DEBUG - worker - Got message on websocket.connect (reply websocket.send!FlEitltfgsCC)2017-02-06 10:42:04,710 - DEBUG - runworker - websocket.connect2017-02-06 10:42:04,711 - DEBUG - worker - Dispatching message on websocket.connect to channels.routing.connect_consumer
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.