diff --git a/examples/client/async/fiddle_client.py b/examples/client/async/fiddle_client.py
index 5b43dcc..e5aeb6c 100644
--- a/examples/client/async/fiddle_client.py
+++ b/examples/client/async/fiddle_client.py
@@ -10,8 +10,8 @@ async def connect():
@sio.event
-async def disconnect():
- print('disconnected from server')
+async def disconnect(reason):
+ print('disconnected from server, reason:', reason)
@sio.event
diff --git a/examples/client/sync/fiddle_client.py b/examples/client/sync/fiddle_client.py
index 50f5e2a..71a7a54 100644
--- a/examples/client/sync/fiddle_client.py
+++ b/examples/client/sync/fiddle_client.py
@@ -9,8 +9,8 @@ def connect():
@sio.event
-def disconnect():
- print('disconnected from server')
+def disconnect(reason):
+ print('disconnected from server, reason:', reason)
@sio.event
diff --git a/examples/server/aiohttp/app.html b/examples/server/aiohttp/app.html
index 74d404d..627b918 100644
--- a/examples/server/aiohttp/app.html
+++ b/examples/server/aiohttp/app.html
@@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
- socket.on('disconnect', function() {
- $('#log').append('
Disconnected');
+ socket.on('disconnect', function(reason) {
+ $('#log').append('
Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('
Received: ' + msg.data);
diff --git a/examples/server/aiohttp/app.py b/examples/server/aiohttp/app.py
index cba5193..1568ca1 100644
--- a/examples/server/aiohttp/app.py
+++ b/examples/server/aiohttp/app.py
@@ -70,8 +70,8 @@ async def connect(sid, environ):
@sio.event
-def disconnect(sid):
- print('Client disconnected')
+def disconnect(sid, reason):
+ print('Client disconnected, reason:', reason)
app.router.add_static('/static', 'static')
@@ -84,4 +84,4 @@ async def init_app():
if __name__ == '__main__':
- web.run_app(init_app())
+ web.run_app(init_app(), port=5000)
diff --git a/examples/server/aiohttp/fiddle.py b/examples/server/aiohttp/fiddle.py
index dfde8e1..64ce330 100644
--- a/examples/server/aiohttp/fiddle.py
+++ b/examples/server/aiohttp/fiddle.py
@@ -19,8 +19,8 @@ async def connect(sid, environ, auth):
@sio.event
-def disconnect(sid):
- print('disconnected', sid)
+def disconnect(sid, reason):
+ print('disconnected', sid, reason)
app.router.add_static('/static', 'static')
@@ -28,4 +28,4 @@ app.router.add_get('/', index)
if __name__ == '__main__':
- web.run_app(app)
+ web.run_app(app, port=5000)
diff --git a/examples/server/asgi/app.html b/examples/server/asgi/app.html
index d2f0e9a..ad82656 100644
--- a/examples/server/asgi/app.html
+++ b/examples/server/asgi/app.html
@@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
- socket.on('disconnect', function() {
- $('#log').append('
Disconnected');
+ socket.on('disconnect', function(reason) {
+ $('#log').append('
Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('
Received: ' + msg.data);
diff --git a/examples/server/asgi/app.py b/examples/server/asgi/app.py
index 36af85f..d549ab0 100644
--- a/examples/server/asgi/app.py
+++ b/examples/server/asgi/app.py
@@ -88,8 +88,8 @@ async def test_connect(sid, environ):
@sio.on('disconnect')
-def test_disconnect(sid):
- print('Client disconnected')
+def test_disconnect(sid, reason):
+ print('Client disconnected, reason:', reason)
if __name__ == '__main__':
diff --git a/examples/server/asgi/fiddle.py b/examples/server/asgi/fiddle.py
index 6899ed1..402a379 100644
--- a/examples/server/asgi/fiddle.py
+++ b/examples/server/asgi/fiddle.py
@@ -17,8 +17,8 @@ async def connect(sid, environ, auth):
@sio.event
-def disconnect(sid):
- print('disconnected', sid)
+def disconnect(sid, reason):
+ print('disconnected', sid, reason)
if __name__ == '__main__':
diff --git a/examples/server/javascript/fiddle.js b/examples/server/javascript/fiddle.js
index 940e4da..c6a039a 100644
--- a/examples/server/javascript/fiddle.js
+++ b/examples/server/javascript/fiddle.js
@@ -19,8 +19,8 @@ io.on('connection', socket => {
hello: 'you'
});
- socket.on('disconnect', () => {
- console.log(`disconnect ${socket.id}`);
+ socket.on('disconnect', (reason) => {
+ console.log(`disconnect ${socket.id}, reason: ${reason}`);
});
});
diff --git a/examples/server/sanic/app.html b/examples/server/sanic/app.html
index 30c5964..b87b2df 100644
--- a/examples/server/sanic/app.html
+++ b/examples/server/sanic/app.html
@@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
- socket.on('disconnect', function() {
- $('#log').append('
Disconnected');
+ socket.on('disconnect', function(reason) {
+ $('#log').append('
Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('
Received: ' + msg.data);
diff --git a/examples/server/sanic/app.py b/examples/server/sanic/app.py
index 7f02d23..447ddff 100644
--- a/examples/server/sanic/app.py
+++ b/examples/server/sanic/app.py
@@ -77,8 +77,8 @@ async def connect(sid, environ):
@sio.event
-def disconnect(sid):
- print('Client disconnected')
+def disconnect(sid, reason):
+ print('Client disconnected, reason:', reason)
app.static('/static', './static')
diff --git a/examples/server/sanic/fiddle.py b/examples/server/sanic/fiddle.py
index 5ecb509..405e6e5 100644
--- a/examples/server/sanic/fiddle.py
+++ b/examples/server/sanic/fiddle.py
@@ -21,8 +21,8 @@ async def connect(sid, environ, auth):
@sio.event
-def disconnect(sid):
- print('disconnected', sid)
+def disconnect(sid, reason):
+ print('disconnected', sid, reason)
app.static('/static', './static')
diff --git a/examples/server/tornado/app.py b/examples/server/tornado/app.py
index 16f7a19..58317d9 100644
--- a/examples/server/tornado/app.py
+++ b/examples/server/tornado/app.py
@@ -75,8 +75,8 @@ async def connect(sid, environ):
@sio.event
-def disconnect(sid):
- print('Client disconnected')
+def disconnect(sid, reason):
+ print('Client disconnected, reason:', reason)
def main():
diff --git a/examples/server/tornado/fiddle.py b/examples/server/tornado/fiddle.py
index 1e7e927..b3878a2 100644
--- a/examples/server/tornado/fiddle.py
+++ b/examples/server/tornado/fiddle.py
@@ -24,8 +24,8 @@ async def connect(sid, environ, auth):
@sio.event
-def disconnect(sid):
- print('disconnected', sid)
+def disconnect(sid, reason):
+ print('disconnected', sid, reason)
def main():
diff --git a/examples/server/tornado/templates/app.html b/examples/server/tornado/templates/app.html
index 74d404d..627b918 100644
--- a/examples/server/tornado/templates/app.html
+++ b/examples/server/tornado/templates/app.html
@@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
- socket.on('disconnect', function() {
- $('#log').append('
Disconnected');
+ socket.on('disconnect', function(reason) {
+ $('#log').append('
Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('
Received: ' + msg.data);
diff --git a/examples/server/wsgi/app.py b/examples/server/wsgi/app.py
index 7b019fd..62bd59b 100644
--- a/examples/server/wsgi/app.py
+++ b/examples/server/wsgi/app.py
@@ -94,8 +94,8 @@ def connect(sid, environ):
@sio.event
-def disconnect(sid):
- print('Client disconnected')
+def disconnect(sid, reason):
+ print('Client disconnected, reason:', reason)
if __name__ == '__main__':
diff --git a/examples/server/wsgi/django_socketio/socketio_app/static/index.html b/examples/server/wsgi/django_socketio/socketio_app/static/index.html
index 6dbef78..b10818f 100644
--- a/examples/server/wsgi/django_socketio/socketio_app/static/index.html
+++ b/examples/server/wsgi/django_socketio/socketio_app/static/index.html
@@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
- socket.on('disconnect', function() {
- $('#log').append('
Disconnected');
+ socket.on('disconnect', function(reason) {
+ $('#log').append('
Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('
Received: ' + msg.data);
diff --git a/examples/server/wsgi/django_socketio/socketio_app/views.py b/examples/server/wsgi/django_socketio/socketio_app/views.py
index 854c0fb..f54e1d6 100644
--- a/examples/server/wsgi/django_socketio/socketio_app/views.py
+++ b/examples/server/wsgi/django_socketio/socketio_app/views.py
@@ -78,5 +78,5 @@ def connect(sid, environ):
@sio.event
-def disconnect(sid):
- print('Client disconnected')
+def disconnect(sid, reason):
+ print('Client disconnected, reason:', reason)
diff --git a/examples/server/wsgi/fiddle.py b/examples/server/wsgi/fiddle.py
index 247751b..e9cd703 100644
--- a/examples/server/wsgi/fiddle.py
+++ b/examples/server/wsgi/fiddle.py
@@ -23,8 +23,8 @@ def connect(sid, environ, auth):
@sio.event
-def disconnect(sid):
- print('disconnected', sid)
+def disconnect(sid, reason):
+ print('disconnected', sid, reason)
if __name__ == '__main__':
diff --git a/examples/server/wsgi/templates/index.html b/examples/server/wsgi/templates/index.html
index 8a7308a..e37a6cb 100644
--- a/examples/server/wsgi/templates/index.html
+++ b/examples/server/wsgi/templates/index.html
@@ -11,8 +11,8 @@
socket.on('connect', function() {
socket.emit('my_event', {data: 'I\'m connected!'});
});
- socket.on('disconnect', function() {
- $('#log').append('
Disconnected');
+ socket.on('disconnect', function(reason) {
+ $('#log').append('
Disconnected: ' + reason);
});
socket.on('my_response', function(msg) {
$('#log').append('
Received: ' + msg.data);