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

Method __init__

pywebio/session/threadbased.py:329–345  ·  view source on GitHub ↗

:param thread: 第一次调用PyWebIO交互函数的线程 todo 貌似本参数并不必要 :param on_task_command: 会话结束的处理函数。后端Backend在相应on_session_close时关闭连接时, 需要保证会话内的所有消息都传送到了客户端 :param loop: 事件循环。若 on_task_command 或者on_session_close中有调用使用asyncio事件循环的调用, 则需要事件循环实例来将回调在事件循环的线程中执行

(self, thread, session_info, on_task_command=None, loop=None)

Source from the content-addressed store, hash-verified

327 instance = None
328
329 def __init__(self, thread, session_info, on_task_command=None, loop=None):
330 """
331 :param thread: 第一次调用PyWebIO交互函数的线程 todo 貌似本参数并不必要
332 :param on_task_command: 会话结束的处理函数。后端Backend在相应on_session_close时关闭连接时,
333 需要保证会话内的所有消息都传送到了客户端
334 :param loop: 事件循环。若 on_task_command 或者on_session_close中有调用使用asyncio事件循环的调用,
335 则需要事件循环实例来将回调在事件循环的线程中执行
336 """
337 if ScriptModeSession.instance is not None:
338 raise RuntimeError("ScriptModeSession can only be created once.")
339 ScriptModeSession.instance = self
340
341 super().__init__(target=None, session_info=session_info, on_task_command=on_task_command, loop=loop)
342
343 tid = id(thread)
344 event_mq = queue.Queue(maxsize=self.event_mq_maxsize)
345 self.task_mqs[tid] = event_mq

Callers 1

__init__Method · 0.45

Calls 1

idFunction · 0.85

Tested by

no test coverage detected