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')
Beispiel #2
0
    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)
Beispiel #4
0
 def initialize(self):
     self.r = redis_connection().pubsub()
Beispiel #5
0
def delete(request):
    r = redis_connection()
    r.delete('sheeple')
    emit_to_channel('default_room', 'myevent', 0)
    return HttpResponse()
Beispiel #6
0
def incr(request):
    r = redis_connection()
    count = r.incr('sheeple')
    emit_to_channel('default_room', 'myevent', count)
    return HttpResponse()
 def initialize(self):
     self.r = redis_connection().pubsub()
def sse_delete(request):
    r = redis_connection()
    r.delete('sheeple')
    send_event("myevent", json.dumps(0))
    return HttpResponse()
def delete(request):
    r = redis_connection()
    r.delete('sheeple')
    emit_to_channel('default_room', 'myevent', 0)
    return HttpResponse()
Beispiel #10
0
def sse_incr(request):
    r = redis_connection()
    count = r.incr('sheeple')
    send_event("myevent", json.dumps(count))
    return HttpResponse('OK')
Beispiel #11
0
def incr(request):
    r = redis_connection()
    count = r.incr('sheeple')
    emit_to_channel('default_room', 'myevent', count)
    return HttpResponse()