0
我想通過HTTPS運行以下的eventlet WSGI服務器。我正嘗試從支持HTTPS的Web服務器上的JavaScript連接到python服務器。如何通過HTTPS運行python-socketio(eventlet WSGI服務器)
我想回答下面的描述,我將如何更改下面的代碼以使用HTTPS。
import socketio
import eventlet
import eventlet.wsgi
from flask import Flask, render_template
sio = socketio.Server()
app = Flask(__name__)
@app.route('/')
def index():
"""Serve the client-side application."""
return render_template('index.html')
@sio.on('connect', namespace='/chat')
def connect(sid, environ):
print("connect ", sid)
@sio.on('chat message', namespace='/chat')
def message(sid, data):
print("message ", data)
sio.emit('reply', room=sid)
@sio.on('disconnect', namespace='/chat')
def disconnect(sid):
print('disconnect ', sid)
if __name__ == '__main__':
# wrap Flask application with engineio's middleware
app = socketio.Middleware(sio, app)
# deploy as an eventlet WSGI server
eventlet.wsgi.server(eventlet.listen(('', 8000)), app)
此代碼是從here