我的代码类似于以下代码:
def app(environ, start_response):
websocket = environ['wsgi.websocket']
while True:
#spawn recvWs every time a new client connects
data = 'sample data'
websocket.send(data)
gevent.sleep(0)
if __name__ == '__main__':
server = WSGIServer(("0.0.0.0", 80), app,handler_class=WebSocketHandler)
server.serve_forever()
尽管似乎websocket消息正在以不可预测的速率发送到客户端。我该如何解决?