Comments (6)
using which API?
BTW, which version
from django-websocket-redis.
Did you implement it as written here?
http://django-websocket-redis.readthedocs.org/en/latest/api.html
from django-websocket-redis.
i'm using current git and i need to publish messages to different facilities from a celery task so i do:
b = RedisPublisher(facility='team-0", broadcast=True)
b.publish_message("test0")
b = RedisPublisher(facility='team-1", broadcast=True)
b.publish_message("test1")
The first message will go to "team-0" but the second message will go to both team-0 and team-1.
from django-websocket-redis.
(current git as yesterday.. i didn't have time to check again today)
from django-websocket-redis.
If you want to dispatch a message to different users, instead of using a different facility, you should use a different audience, say:
b = RedisPublisher(facility='a_name', user='team-0')
b.publish_message("test0")
b = RedisPublisher(facility='a_name', user='team-1')
b.publish_message("test1")
but anyway, your code is correct and indeed this seems weird.
Could you please check with redis-cli what kind of messages have been added.
For this WS4REDIS_EXPIRE must be, say 3600.
# redis-cli
redis 127.0.0.1:6379> get broadcast:team-0
redis 127.0.0.1:6379> get broadcast:team-1
from django-websocket-redis.
As i said(maybe i've not explained it very well, sorry for that!) in the first report the problem is that the class RedisStore declares _publishers as a class variable. This means that all RedisStore instances will share the same _publishers variable. For example this code:
class TestC:
_a = []
def __init__(self):
self._b = []
def test(self):
self._a.append('a')
self._b.append('b')
return (self._a, self._b)
b = TestC()
print b.test()
c = TestC()
print c.test()
will output
(['a'], ['b'])
(['a', 'a'], ['b'])
You don't want _publishers to be a class variable but an instance variable and so you have to declare it inside init. I hope i made myself clear!
from django-websocket-redis.
Related Issues (20)
- How to define {{ WEBSOCKET_URI }} with corresponding slug on front end?
- uWSGI server not working like the docs HOT 3
- 1
- WebSocket Connection refused
- Subscription not created, errors? How to debug?
- Websocket doesn't run after reloading whole site and starting uwsgi
- ws4redis slices messages HOT 1
- DWR doesn't work with overridden groups
- Switching from username to users id HOT 1
- Handle ssl connections HOT 4
- Exception: 'LimitedStream' object has no attribute 'raw' when using Django 2.1.5 HOT 7
- django-websocket-redis with gunicorn
- WebSocket opening handshake timed out in https
- ValueError: filedescriptor out of range in select() HOT 1
- Django Websocket send data HOT 1
- Each websocket connection results into a brand new socket connection to redis hence it implicitly limits the maximum number of websockets that could be established by using this library HOT 2
- Whether clustering is supported or not?
- Compatibility with Django 3.2 and new release of django-websocket-redis
- OSS License compatibility question HOT 1
- No module named 'django.utils.six'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-websocket-redis.