【Flask】Flask实现websocket报错werkzeug.routing.WebsocketMismatch解决办法

原因是flask版本过高,降级以后即可成功。(也可以去寻找新版本的写法,临时处理为降级软件包)

Traceback (most recent call last):                                                                                                                                                                                                                File "/home/gaojiang/.local/lib/python3.8/site-packages/gevent/pywsgi.py", line 999, in handle_one_response                                                                                                                                       self.run_application()                                                                                                                                                                                                                        File "/home/gaojiang/.local/lib/python3.8/site-packages/geventwebsocket/handler.py", line 75, in run_application
    self.run_websocket()                                                                                                                                                                                                                          File "/home/gaojiang/.local/lib/python3.8/site-packages/geventwebsocket/handler.py", line 52, in run_websocket                                                                                                                                    list(self.application(self.environ, lambda s, h, e=None: []))                                                                                                                                                                                 File "/home/gaojiang/.local/lib/python3.8/site-packages/flask/app.py", line 2091, in __call__                                                                                                                                                     return self.wsgi_app(environ, start_response)
  File "/home/gaojiang/.local/lib/python3.8/site-packages/flask_sockets.py", line 40, in __call__
    handler, values = adapter.match()
  File "/home/gaojiang/.local/lib/python3.8/site-packages/werkzeug/routing.py", line 2026, in match
    raise WebsocketMismatch()
werkzeug.routing.WebsocketMismatch: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
2021-10-22T08:11:08Z {'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '60922', 'HTTP_HOST': '127.0.0.1:5000', (hidden keys: 30)} failed with WebsocketMismatch

pip3 install flask==1.1.2

pip3 install  Werkzeug==1.0.2

降级后成功访问

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值