Yaro Kifor
2018-11-13 22:01:20 UTC
Hello,
I am a little new to channels, but I can't seem to figure out this issue. I
am trying to use group_send from an external process and I am using Redis
as my channel backend. Here is what my process code looks like:
from channels.layers import get_channel_layer
from multiprocessing import Process
from asgiref.sync import AsyncToSync, SyncToAsync
class GenericAgent(Process):
def __init__(self, *args, **kwargs):
self.channel_layer = get_channel_layer()
self.send_message = AsyncToSync(self.channel_layer.group_send)
super().__init__(*args, **kwargs)
def run(self):
while True:
print("Sending data")
self.send_message('test', {'test': 0})
time.sleep(1)
Anytime I run the process it will print out "Sending data" once and do
nothing else. Any channel that is part of the test group will not receive
anything as well. If anyone has a clue to what the issue might be please
let know your help is greatly appreciated.
Here is my pip freeze:
aioredis==1.2.0
asgiref==2.3.2
async-timeout==3.0.1
attrs==18.2.0
autobahn==18.11.1
Automat==0.7.0
certifi==2018.4.16
channels==2.1.5
channels-redis==2.3.1
chardet==3.0.4
constantly==15.1.0
daphne==2.2.3
Django==2.0.6
easy-thumbnails==2.5
future==0.15.2
hiredis==0.2.0
hyperlink==18.0.0
idna==2.7
imageio==2.3.0
incremental==17.5.0
interop==0.0.0
LatLon23==1.0.7
monotonic==1.2
msgpack==0.5.6
numpy==1.14.4
Pillow==5.1.0
psycopg2-binary==2.7.5
PyHamcrest==1.9.0
pyproj==1.9.5.1
pytz==2018.4
rawpy==0.10.1
requests==2.19.1
six==1.11.0
sorl-thumbnail==12.4.1
Twisted==18.9.0
txaio==18.8.1
urllib3==1.23
zope.interface==4.6.0
Thanks in advance,
Yaro
I am a little new to channels, but I can't seem to figure out this issue. I
am trying to use group_send from an external process and I am using Redis
as my channel backend. Here is what my process code looks like:
from channels.layers import get_channel_layer
from multiprocessing import Process
from asgiref.sync import AsyncToSync, SyncToAsync
class GenericAgent(Process):
def __init__(self, *args, **kwargs):
self.channel_layer = get_channel_layer()
self.send_message = AsyncToSync(self.channel_layer.group_send)
super().__init__(*args, **kwargs)
def run(self):
while True:
print("Sending data")
self.send_message('test', {'test': 0})
time.sleep(1)
Anytime I run the process it will print out "Sending data" once and do
nothing else. Any channel that is part of the test group will not receive
anything as well. If anyone has a clue to what the issue might be please
let know your help is greatly appreciated.
Here is my pip freeze:
aioredis==1.2.0
asgiref==2.3.2
async-timeout==3.0.1
attrs==18.2.0
autobahn==18.11.1
Automat==0.7.0
certifi==2018.4.16
channels==2.1.5
channels-redis==2.3.1
chardet==3.0.4
constantly==15.1.0
daphne==2.2.3
Django==2.0.6
easy-thumbnails==2.5
future==0.15.2
hiredis==0.2.0
hyperlink==18.0.0
idna==2.7
imageio==2.3.0
incremental==17.5.0
interop==0.0.0
LatLon23==1.0.7
monotonic==1.2
msgpack==0.5.6
numpy==1.14.4
Pillow==5.1.0
psycopg2-binary==2.7.5
PyHamcrest==1.9.0
pyproj==1.9.5.1
pytz==2018.4
rawpy==0.10.1
requests==2.19.1
six==1.11.0
sorl-thumbnail==12.4.1
Twisted==18.9.0
txaio==18.8.1
urllib3==1.23
zope.interface==4.6.0
Thanks in advance,
Yaro
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4916f184-9db9-4d34-a9cd-3d6ff5238aff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4916f184-9db9-4d34-a9cd-3d6ff5238aff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.