MCPcopy Index your code
hub / github.com/rawpython/remi / _send_spontaneous_websocket_message

Method _send_spontaneous_websocket_message

remi/server.py:522–539  ·  view source on GitHub ↗
(self, message)

Source from the content-addressed store, hash-verified

520 self._send_spontaneous_websocket_message(msg)
521
522 def _send_spontaneous_websocket_message(self, message):
523 for ws in list(self.websockets):
524 # noinspection PyBroadException
525 try:
526 if ws.send_message(message):
527 #if message sent ok, continue with next client
528 continue
529 except Exception:
530 self._log.error("sending websocket spontaneous message", exc_info=True)
531
532 self._log.debug("removing websocket instance, communication error with client")
533 #here arrives if the message was not sent ok, then the client is removed
534 try:
535 self.websockets.remove(ws)
536 except Exception:
537 pass # happens when there are multiple clients
538 else:
539 ws.close(terminate_server=False)
540
541 def execute_javascript(self, code):
542 self._send_spontaneous_websocket_message(_MSG_JS + code)

Callers 3

do_gui_updateMethod · 0.95
set_root_widgetMethod · 0.95
execute_javascriptMethod · 0.95

Calls 2

send_messageMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected