Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the reason argument for async_admin when socket disconnect #1423

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/socketio/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ def _connect(self, eio_sid, namespace):
), namespace=self.admin_namespace)
return sid

def _disconnect(self, sid, namespace, **kwargs):
def _disconnect(self, sid, namespace, reason, **kwargs):
del self.sio.manager._timestamps[sid]
self.sio.emit('socket_disconnected', (
namespace,
sid,
'N/A',
reason or 'N/A',
datetime.utcnow().isoformat() + 'Z',
), namespace=self.admin_namespace)
return self.sio.manager.__disconnect(sid, namespace, **kwargs)
Expand Down Expand Up @@ -303,9 +303,9 @@ def _handle_eio_connect(self, eio_sid, environ):
self.event_buffer.push('rawConnection')
return self.sio._handle_eio_connect(eio_sid, environ)

def _handle_eio_disconnect(self, eio_sid):
def _handle_eio_disconnect(self, eio_sid, reason):
self.event_buffer.push('rawDisconnection')
return self.sio._handle_eio_disconnect(eio_sid)
return self.sio._handle_eio_disconnect(eio_sid, reason)

def _eio_http_response(self, packets=None, headers=None, jsonp_index=None):
ret = self.sio.eio.__ok(packets=packets, headers=headers,
Expand Down
8 changes: 4 additions & 4 deletions src/socketio/async_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ async def _connect(self, eio_sid, namespace):
), namespace=self.admin_namespace)
return sid

async def _disconnect(self, sid, namespace, **kwargs):
async def _disconnect(self, sid, namespace, reason, **kwargs):
del self.sio.manager._timestamps[sid]
await self.sio.emit('socket_disconnected', (
namespace,
sid,
'N/A',
reason or 'N/A',
datetime.utcnow().isoformat() + 'Z',
), namespace=self.admin_namespace)
return await self.sio.manager.__disconnect(sid, namespace, **kwargs)
Expand Down Expand Up @@ -292,9 +292,9 @@ async def _handle_eio_connect(self, eio_sid, environ):
self.event_buffer.push('rawConnection')
return await self.sio._handle_eio_connect(eio_sid, environ)

async def _handle_eio_disconnect(self, eio_sid):
async def _handle_eio_disconnect(self, eio_sid, reason):
self.event_buffer.push('rawDisconnection')
return await self.sio._handle_eio_disconnect(eio_sid)
return await self.sio._handle_eio_disconnect(eio_sid, reason)

def _eio_http_response(self, packets=None, headers=None, jsonp_index=None):
ret = self.sio.eio.__ok(packets=packets, headers=headers,
Expand Down
Loading