ITeye博客

flask_socketio + nginx + uwsgi + gevent + websocket实现稳定消息通讯

zlr · 2020-04-27 10:50 · Web前端 · Markdown

1、nginx反向代理配置:

location /socket.io { include uwsgi_params;

    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";

    uwsgi_pass  127.0.0.1:5000;

}

2、uwsgi ini文件配置:

socket = 127.0.0.1:5000 master = true chdir = wsgi-file = processes = 1 stats = 127.0.0.1:9591 daemonize = /psd/logs/uwsgi.log pidfile = uwsgi.pid vacuum = true callable = app enable-threads = true log-maxsize = 10000000 disable-logging = true buffer-size=32768

http-websockets = true gevent = 100 gevent-early-monkey-patch = true

3、flask_socketio 后台代码,网上一大堆 from flask_socketio import SocketIO, emit ...

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。