为什么Gevent WebSocket的发送速率无法预测

时间:2018-11-11 06:42:06

标签: python-3.x websocket gevent greenlets

我的代码类似于以下代码:

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消息正在以不可预测的速率发送到客户端。我该如何解决?

0 个答案:

没有答案