def sse_push_message(request): #if request.method == 'POST': r = redis_connection() #dd = Usernote.objects.create(title=request.POST['message']) #d = UsernoteSerializer(dd) send_event("myevent",json.dumps('hai')) return HttpResponse('OK')
def listener(self, room): r = redis_connection().pubsub() r.subscribe("socketio_%s" % room) for m in r.listen(): if m["type"] == "message": data = json.loads(m["data"]) self.process_event(data)
def listener(self, room): r = redis_connection().pubsub() r.subscribe('socketio_%s' % room) for m in r.listen(): if m['type'] == 'message': data = json.loads(m['data']) self.process_event(data)
def initialize(self): self.r = redis_connection().pubsub()
def delete(request): r = redis_connection() r.delete('sheeple') emit_to_channel('default_room', 'myevent', 0) return HttpResponse()
def incr(request): r = redis_connection() count = r.incr('sheeple') emit_to_channel('default_room', 'myevent', count) return HttpResponse()
def sse_delete(request): r = redis_connection() r.delete('sheeple') send_event("myevent", json.dumps(0)) return HttpResponse()
def sse_incr(request): r = redis_connection() count = r.incr('sheeple') send_event("myevent", json.dumps(count)) return HttpResponse('OK')