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")
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")
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")