You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 29, 2022. It is now read-only.
Hi @ShawnChen-dev - you really need to give a lot more explanation about what you're trying to do specifically. What you're using, what code you've ran etc before anyone can help you.
From the very little we can see, it looks like perhaps the environ dictionary doesn't have the key "wsgi.websocket" as a literal. Though without knowing more it's hard to say what's going on.
Thank you for the reminder. I did it :
`import json
from flask import Flask
from flask_sockets import Sockets
app = Flask(name)
sockets = Sockets(app)
@sockets.route('/echo')
def echo_socket(ws):
while not ws.closed:
message = ws.receive()
if message is not None:
ws.send(json.dumps({'output': message['output']}))
if name == "main":
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
server = pywsgi.WSGIServer(('0.0.0.0', 9017), app, handler_class=WebSocketHandler)
server.serve_forever()
`
Deploy to centos7 and run this file directly. Both interfaces are normal, but running through uwsgi(uwsgi --ini flask_uwsgi.ini), HTTP interface is normal, and WS interface throws an exception
environment = environment [' wsgi.websocket ]
KeyError: ' wsgi.websocket '
uwsgi config: [uwsgi] uid=root gid=root http-socket = 0.0.0.0:9024 chdir=/root/test-scc/scc_service master=true vhost = True workers = 2 enable-threads = True wsgi-file= run.py callable = app module=run:app logto=/var/error.log python-autoreload=1 touch-chain-reload = true uwsgi_read_timeout = 600 limit-as = 6048 processes=4 gevent= 100
This problem has bothered me for a long time. I hope my experienced friends can help me!
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Receive message interface exception information as follows:
environment = environ['wsgi.websocket']
KeyError: 'wsgi.websocket'
The text was updated successfully, but these errors were encountered: