I just can not figure it out how I can restrict users from publishing messages to broadcast channel.
I send information to front ends and run javascript based on that and so no client should be able to initiate such javascript on other clients.
I am publishing redis messages like this.
data = json.dumps(dict) redis_message = RedisMessage(data) RedisPublisher(facility='chat', broadcast=True).publish_message(redis_message)
And catching them in frontends like this:
ws.onmessage = function(e) { if (obj.type === "chat") { do chat... }
If I could get some more elaborate example of how to use WS4REDIS_ALLOWED_CHANNELS
and
def get_allowed_channels(request, channels):
return set(channels).intersection(['subscribe-broadcast', 'subscribe-group'])
function.
Hello!
I just can not figure it out how I can restrict users from publishing messages to broadcast channel. I send information to front ends and run javascript based on that and so no client should be able to initiate such javascript on other clients.
I am publishing redis messages like this.
data = json.dumps(dict) redis_message = RedisMessage(data) RedisPublisher(facility='chat', broadcast=True).publish_message(redis_message)
And catching them in frontends like this:
ws.onmessage = function(e) { if (obj.type === "chat") { do chat... }
If I could get some more elaborate example of how to use WS4REDIS_ALLOWED_CHANNELS and def get_allowed_channels(request, channels): return set(channels).intersection(['subscribe-broadcast', 'subscribe-group']) function.
Thanks!