示例#1
0
def pusher_authentication():
    channel_name = request.form.get('channel_name')
    socket_id = request.form.get('socket_id')

    auth = pusher.authenticate(channel=channel_name, socket_id=socket_id)

    return jsonify(auth)
示例#2
0
def pusher_authentication(request):
    auth = pusher.authenticate(channel=request.POST['channel_name'],
                               socket_id=request.POST['socket_id'],
                               custom_data={
                                   u'user_id': name,
                                   u'user_info': {
                                       u'role': u'player'
                                   }
                               })
    return JsonResponse(auth)
示例#3
0
def pusher_authentication():
    channel_name = request.form.get('channel_name')
    socket_id = request.form.get('socket_id')

    username = get_jwt_identity()

    user_data = User.query.filter_by(username=username).first()

    auth = pusher.authenticate(channel=channel_name,
                               socket_id=socket_id,
                               custom_data={
                                   "user_id": user_data.id,
                                   "user_info": {
                                       "username": user_data.username
                                   }
                               })

    return jsonify(auth)
示例#4
0
 def post(self, request):
     auth = pusher.authenticate(channel=request.form['channel_name'],
                                socket_id=request.form['socket_id'])
     return json.dumps(auth)