Invoke an application event handler.
(self, event, namespace, *args)
| 615 | self.manager.trigger_callback(sid, id, data) |
| 616 | |
| 617 | def _trigger_event(self, event, namespace, *args): |
| 618 | """Invoke an application event handler.""" |
| 619 | # first see if we have an explicit handler for the event |
| 620 | handler, args = self._get_event_handler(event, namespace, args) |
| 621 | if handler: |
| 622 | try: |
| 623 | return handler(*args) |
| 624 | except TypeError: |
| 625 | # legacy disconnect events use only one argument |
| 626 | if event == 'disconnect': |
| 627 | return handler(*args[:-1]) |
| 628 | else: # pragma: no cover |
| 629 | raise |
| 630 | # or else, forward the event to a namespace handler if one exists |
| 631 | handler, args = self._get_namespace_handler(namespace, args) |
| 632 | if handler: |
| 633 | return handler.trigger_event(event, *args) |
| 634 | else: |
| 635 | return self.not_handled |
| 636 | |
| 637 | def _handle_eio_connect(self, eio_sid, environ): |
| 638 | """Handle the Engine.IO connection event.""" |