MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / notify_connection_lost

Method notify_connection_lost

pywebio/platform/adaptor/ws.py:202–213  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

200 self.session.send_client_event(event)
201
202 def notify_connection_lost(self):
203 logger.debug("WebSocket closed")
204 if not self.reconnectable and self.session:
205 # when the connection lost is caused by `on_session_close()`, it's OK to close the session here though.
206 # because the `session.close()` is reentrant
207 self.session.close(nonblock=True)
208 self.session = None # reset the reference
209 return
210
211 _reconnect_state.active_connections.pop(self.session_id, None)
212 if self.session_id in _reconnect_state.unclosed_sessions:
213 _reconnect_state.detached_sessions[self.session_id] = time.time()

Callers 3

websocket_endpointFunction · 0.95
wshandleFunction · 0.95
on_closeMethod · 0.80

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected