MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / send_client_event

Method send_client_event

pywebio/session/threadbased.py:144–161  ·  view source on GitHub ↗

向会话发送来自用户浏览器的事件️ :param dict event: 事件️消息

(self, event)

Source from the content-addressed store, hash-verified

142 return event
143
144 def send_client_event(self, event):
145 """向会话发送来自用户浏览器的事件️
146
147 :param dict event: 事件️消息
148 """
149 task_id = event['task_id']
150 mq = self.task_mqs.get(task_id)
151 if not mq and task_id in self.callbacks:
152 mq = self.callback_mq
153
154 if not mq:
155 logger.error('event_mqs not found, task_id:%s', task_id)
156 return
157
158 try:
159 mq.put_nowait(event) # disable blocking, because this is call by backend
160 except queue.Full:
161 logger.error('Message queue is full, discard new messages') # todo: alert user
162
163 def get_task_commands(self):
164 return self.unhandled_task_msgs.get()

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected