diff --git a/src/socketio/async_namespace.py b/src/socketio/async_namespace.py index 0a2e0515..89442aeb 100644 --- a/src/socketio/async_namespace.py +++ b/src/socketio/async_namespace.py @@ -29,7 +29,7 @@ async def trigger_event(self, event, *args): Note: this method is a coroutine. """ - handler_name = 'on_' + event + handler_name = 'on_' + (event or '') if hasattr(self, handler_name): handler = getattr(self, handler_name) if asyncio.iscoroutinefunction(handler) is True: @@ -194,7 +194,7 @@ async def trigger_event(self, event, *args): Note: this method is a coroutine. """ - handler_name = 'on_' + event + handler_name = 'on_' + (event or '') if hasattr(self, handler_name): handler = getattr(self, handler_name) if asyncio.iscoroutinefunction(handler) is True: diff --git a/src/socketio/namespace.py b/src/socketio/namespace.py index ab4f69f8..3bf4f95b 100644 --- a/src/socketio/namespace.py +++ b/src/socketio/namespace.py @@ -21,7 +21,7 @@ def trigger_event(self, event, *args): method can be overridden if special dispatching rules are needed, or if having a single method that catches all events is desired. """ - handler_name = 'on_' + event + handler_name = 'on_' + (event or '') if hasattr(self, handler_name): return getattr(self, handler_name)(*args) @@ -152,7 +152,7 @@ def trigger_event(self, event, *args): method can be overridden if special dispatching rules are needed, or if having a single method that catches all events is desired. """ - handler_name = 'on_' + event + handler_name = 'on_' + (event or '') if hasattr(self, handler_name): return getattr(self, handler_name)(*args)