我正在尝试在同一个Python应用程序中运行Websockets服务器和HTTP服务器。看起来我正在尝试运行两个无限循环,但第二个循环没有被激活。您有什么建议可以让这两个服务器都运行起来吗?
httpd = HTTPServer(('localhost', 8000), SimpleHTTPRequestHandler)
httpd.serve_forever()
asyncio.get_event_loop().run_until_complete(
websockets.serve(echo, 'localhost', 8001))
asyncio.get_event_loop().run_forever()