I am currently experimenting with websockets and have setup a small server:
from gevent import monkey
monkey.patch_all()
import socketio
from flask import Flask, render_template, request
from flask_socketio import SocketIO
app = Flask(__name__)
sio = SocketIO(app,
ping_timeout=2, ping_interval=1,
logger=True, engineio_logger=True)
namespace = '/test'
@sio.on('connect', namespace=namespace)
def on_connect():
print('Client connected', request.sid)
@sio.on('disconnect', namespace=namespace)
def on_disconnect():
print('Client disconnected', request.sid)
if __name__ == '__main__':
sio.run(app, port=5003)
When I connect to the server (code below) everything works fine, I receive ping/pong debug output in my server console.
var socket = io('//localhost:5003/test');
When I close the browser tab, the connection closes and I received the disconnect
event. After the message is printed, I receive the following set of exceptions: gist
This appears similar to this issue from 2015, which was apparently fixed then. I am using
Python 3.6.0 (default, Mar 4 2017, 12:32:34)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
python-engineio==1.5.2
python-socketio==1.7.4
Flask-SocketIO==2.8.6
gevent==1.2.1
greenlet==0.4.12
Is there something I have done wrong in my setup or is this an issue within socketio?