MCPcopy Create free account
hub / github.com/miguelgrinberg/python-socketio / trigger_callback

Method trigger_callback

src/socketio/async_manager.py:102–121  ·  view source on GitHub ↗

Invoke an application callback. Note: this method is a coroutine.

(self, sid, id, data)

Source from the content-addressed store, hash-verified

100 return self.basic_close_room(room, namespace)
101
102 async def trigger_callback(self, sid, id, data):
103 """Invoke an application callback.
104
105 Note: this method is a coroutine.
106 """
107 callback = None
108 try:
109 callback = self.callbacks[sid][id]
110 except KeyError:
111 # if we get an unknown callback we just ignore it
112 self._get_logger().warning('Unknown callback received, ignoring.')
113 else:
114 del self.callbacks[sid][id]
115 if callback is not None:
116 ret = callback(*data)
117 if inspect.iscoroutine(ret):
118 try:
119 await ret
120 except asyncio.CancelledError: # pragma: no cover
121 pass

Callers

nothing calls this directly

Calls 1

_get_loggerMethod · 0.80

Tested by

no test coverage detected