0
이것은 socket_io의 base_manager.py에 있습니다. python server ->이 코드는 어떤 의미입니까? 나는 메시지를 내고 싶다. 방이 없다면 어떻게 작동할까요? 네임 스페이스가없는 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)