def METHOD_NAME(ws, message):
    data = json.loads(message)
    code = data['header']['code']
    if code != 0:
        print(f'请求错误: {code}, {data}')
        ws.close()
        self.time_to_exit_event.set()
    else:
        choices = data["payload"]["choices"]
        status = choices["status"]
        content = choices["text"][0]["content"]
        ws.content += content
        self.result_buf += content
        if status == 2:
            ws.close()
            self.time_to_exit_event.set()
    self.time_to_yield_event.set()