0
這是在socket_io python服務器中的base_manager.py - >這段代碼有什麼意義?我想發出一條消息。如果沒有房間,那該怎麼辦?如果命名空間不self.rooms - >沒有空間,所以它總是會返回到呼叫方的權利?:套接字io代碼混淆
def emit(self, event, data, namespace, room=None, skip_sid=None,
callback=None):
"""Emit a message to a single client, a room, or all the clients
connected to the namespace."""
if namespace not in self.rooms or room not in self.rooms[namespace]:
return
for sid in self.get_participants(namespace, room):
if sid != skip_sid:
if callback is not None:
id = self._generate_ack_id(sid, namespace, callback)
else:
id = None
self.server._emit_internal(sid, event, data, namespace, id)