Invoke an application callback. Note: this method is a coroutine.
(self, sid, id, data)
| 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 |
nothing calls this directly
no test coverage detected