示例#1
0
    def get(self):
        data = {'OrderType': 100001, 'OrderId': None}

        socketio.emit('foo response', {'data': data},
                      namespace='/foo',
                      broadcast=True)
        return data
示例#2
0
def join_room_(data):
    # ["nickname", "cid"]
    print("event join")
    room = "room:" + str(data['cid'])
    join_room(room)
    socketio.emit("join_room", data['nickname'], room=room)
    print("emit finish")
示例#3
0
    def get(self):
        data = {
            'Message': 400003,
        }

        socketio.emit('bar response', {'data': data},
                      namespace='/foo',
                      broadcast=True)
        return data
示例#4
0
def send_message(data):
    # ["content", "uid", "cid", "content"]
    print("event send")
    room = "room:" + str(data['cid'])
    message = dict()
    message['content'] = data['content']
    user = User.query.get(int(data['uid']))
    message['user'] = user.to_json()
    socketio.emit("send_message", message, room=room)
    print("emit finish")
示例#5
0
 def emit_socket(name, data):
     socketio.emit(name, data, broadcast=True, room=tower.tower_id)
示例#6
0
def leave_room_(data):
    print("event leave")
    room = "room:" + str(data['cid'])
    leave_room(room)
    socketio.emit("leave_room", data["nickname"], room=room)
    print("emit finish")