MCPcopy Create free account
hub / github.com/miguelgrinberg/python-socketio / get_participants

Method get_participants

src/socketio/base_manager.py:34–49  ·  view source on GitHub ↗

Return an iterable with the active participants in a room. Note that in a multi-server scenario this method only returns the participants connect to the server in which the method is called. There is currently no functionality to assemble a complete list of users acr

(self, namespace, room)

Source from the content-addressed store, hash-verified

32 return self.rooms.keys()
33
34 def get_participants(self, namespace, room):
35 """Return an iterable with the active participants in a room.
36
37 Note that in a multi-server scenario this method only returns the
38 participants connect to the server in which the method is called. There
39 is currently no functionality to assemble a complete list of users
40 across multiple servers.
41 """
42 ns = self.rooms.get(namespace, {})
43 if hasattr(room, '__len__') and not isinstance(room, str):
44 participants = ns[room[0]]._fwdm.copy() if room[0] in ns else {}
45 for r in room[1:]:
46 participants.update(ns[r]._fwdm if r in ns else {})
47 else:
48 participants = ns[room]._fwdm.copy() if room in ns else {}
49 yield from participants.items()
50
51 def connect(self, eio_sid, namespace):
52 """Register a client connection to a namespace."""

Callers 15

basic_close_roomMethod · 0.95
emitMethod · 0.80
configMethod · 0.80
admin_enter_roomMethod · 0.80
admin_leave_roomMethod · 0.80
admin_disconnectMethod · 0.80
_emitMethod · 0.80
configMethod · 0.80
admin_enter_roomMethod · 0.80
admin_leave_roomMethod · 0.80
admin_disconnectMethod · 0.80
_emitMethod · 0.80

Calls 1

getMethod · 0.45

Tested by 2

test_get_participantsMethod · 0.64
test_get_participantsMethod · 0.64