forked from miguelgrinberg/python-socketio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase_namespace.py
More file actions
33 lines (24 loc) · 978 Bytes
/
Copy pathbase_namespace.py
File metadata and controls
33 lines (24 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class BaseNamespace(object):
def __init__(self, namespace=None):
self.namespace = namespace or '/'
def is_asyncio_based(self):
return False
class BaseServerNamespace(BaseNamespace):
def __init__(self, namespace=None):
super().__init__(namespace=namespace)
self.server = None
def _set_server(self, server):
self.server = server
def rooms(self, sid, namespace=None):
"""Return the rooms a client is in.
The only difference with the :func:`socketio.Server.rooms` method is
that when the ``namespace`` argument is not given the namespace
associated with the class is used.
"""
return self.server.rooms(sid, namespace=namespace or self.namespace)
class BaseClientNamespace(BaseNamespace):
def __init__(self, namespace=None):
super().__init__(namespace=namespace)
self.client = None
def _set_client(self, client):
self.client = client