def get(self): data = {'OrderType': 100001, 'OrderId': None} socketio.emit('foo response', {'data': data}, namespace='/foo', broadcast=True) return data
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")
def get(self): data = { 'Message': 400003, } socketio.emit('bar response', {'data': data}, namespace='/foo', broadcast=True) return data
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")
def emit_socket(name, data): socketio.emit(name, data, broadcast=True, room=tower.tower_id)
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")