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

Method _send_msg_to_client

pywebio/platform/adaptor/ws.py:167–182  ·  view source on GitHub ↗
(self, session: Session = None)

Source from the content-addressed store, hash-verified

165 return conn
166
167 def _send_msg_to_client(self, session: Session = None):
168 conn = self._get_active_connection()
169 session = session or self.session
170
171 if not conn or conn.closed():
172 return
173
174 for msg in session.get_task_commands():
175 try:
176 conn.write_message(msg)
177 except TypeError as e:
178 logger.exception('Data serialization error: %s\n'
179 'This may be because you pass the wrong type of parameter to the function'
180 ' of PyWebIO.\nData content: %s', e, msg)
181 except Exception:
182 logger.exception("Error in sending message via websocket")
183
184 def _close_from_session(self):
185 conn = self._get_active_connection()

Callers 2

__init__Method · 0.95
_close_from_sessionMethod · 0.95

Calls 4

closedMethod · 0.65
get_task_commandsMethod · 0.45
write_messageMethod · 0.45

Tested by

no test coverage detected