Answer the question
In order to leave comments, you need to log in
Will flask-sock work with the POST method? Will it handle multiple requests from clients at once?
Can you please tell me if the routes / and /test will work when running "gunicorn --access-logfile - -w 1 --threads 50 --bind 0.0.0.0:5000 controller:app"?
The build on the docker is long, I want to know in advance what is wrong ...
from app import app
...
from flask_sock import Sock
sock = Sock(app)
@sock.route('/test', methods=['POST'])
@cross_origin()
def test(ws):
while True:
message = ws.receive()
print(message)
success = "success"
request_json = request.get_json()
text = request_json.get("text", "")
if text == "":
ws.send(answer(422, "fail: Bad request. Enter text.", []))
continue
@app.route('/', methods=['GET'])
@cross_origin()
def ping():
http_code = 200
return make_response(jsonify(status_code=http_code, message="success"), http_code)
if __name__ == '__main__':
app.run()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question