html 蟒蛇,烧瓶,socketio

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 蟒蛇,烧瓶,socketio相关的知识,希望对你有一定的参考价值。

from flask_socketio import SocketIO, emit, send

app = Flask(__name__)
app.config['SECRET_KEY'] = 'mysecret'
socketio = SocketIO(app)

# getting the message that is sent from the js
@socketio.on('backup')
def handleMessage(msg):
    print('Message: ' + msg)
    send

// send a message from the js to the python socketio
// in here we are sending the text that is in the inputBox
function runBackup(){
    input = document.getElementById('beginBackupBtn').value;
    var socket = io.connect('http://127.0.0.1:5000');
    socket.on('connect', function(){
        socket.send(input);
    });
    };
<!--  Here is the import that should be in the headr for having the socket enabled in the js -->

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>

以上是关于html 蟒蛇,烧瓶,socketio的主要内容,如果未能解决你的问题,请参考以下文章

烧瓶 socketio CORS

在 SocketIO 命名空间中使用烧瓶会话数据时出错

烧瓶-SocketIO + uWSGI。与 Mule 工人一起发射

使用烧瓶socketio经常断开套接字连接

php header('刷新: 1;url=destination');在烧瓶+蟒蛇?

在 Uwsgi 和 Nginx 上使用 SocketIO 烧瓶