예제 #1
0
def pusher_auth(request):
    channel = request.POST["channel_name"]
    socket_id = request.POST["socket_id"]

    if pusher.allow_connection(request, channel):
        r = pusher._real_getitem(channel).authenticate(socket_id)
        return HttpResponse(json.dumps(r), content_type="application/json")
    return HttpResponseForbidden("Not Authorized")
예제 #2
0
def pusher_auth(request):
    channel = request.POST["channel_name"]
    socket_id = request.POST["socket_id"]

    if pusher.allow_connection(request, channel):
        r = pusher._real_getitem(channel).authenticate(socket_id)
        return HttpResponse(json.dumps(r), mimetype="application/json")
    return HttpResponseForbidden("Not Authorized")
예제 #3
0
파일: views.py 프로젝트: gnublade/echoic
def pusher_auth(request):
    channel = request.POST["channel_name"]
    socket_id = request.POST["socket_id"]
    latlon = request.session.get('location')
    info = {'lat': latlon[0], 'lon': latlon[1]} if latlon else None
    r = pusher._real_getitem(channel).authenticate(socket_id, {
        'user_id': socket_id,
        'user_info': info,
    })
    return HttpResponse(json.dumps(r), mimetype="application/json")