def client_info(data): print('client data', data) _type = data.get('_type') if _type == 'tail': tail_command.background_thread() elif _type == 'ps': ps_command.background_thread() elif _type == 'top': top_command.background_thread() else: socketio.emit('response', {'text': '未知命令'}, namespace='/shell')
def leave(data): print('leave data', data) _type = data.get('_type') if _type == 'tail': tail_command.leave() elif _type == 'ps': ps_command.leave() elif _type == 'top': top_command.leave() else: socketio.emit('response', {'text': '未知命令'}, namespace='/shell')
def send_response(self, text): socketio.emit(self.event_name, { 'text': text, '_type': self.cmd_name }, namespace=self.namespace)