It is important to note that class-based namespaces are singletons. In the case that an event has a handler in a class-based namespace, and also aĭecorator-based function handler, only the standalone function handler is To the proper namespace when the namespace argument is not given. Socketio.Server and socketio.AsyncServer classes that default Instance includes versions of several of the methods in the All event names used inĬlass-based namespaces must use characters that are legal in method names.Īs a convenience to methods defined in a class-based namespace, the namespace The namespace class, then the event is ignored. If an event is received for which there is no corresponding method defined in ForĮxample, event my_event will be handled by a method named on_my_event. When class-based namespaces are used, any events received by the server areĭispatched to a method named as the event name with the on_ prefix.
However, GOSF models a basic request/response cycle to make instigated flows easy. Socket.IO's connections are stateful, which means that data can be pushed directly to the client without being instigated by a request. register_namespace ( M圜ustomNamespace ( '/test' )) The request/response cycle describes how data flows from the client to the server and back to the client through GOSF. AsyncNamespace ): def on_connect ( self, sid, environ ): pass def on_disconnect ( self, sid ): pass async def on_my_event ( self, sid, data ): await self.