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)
| 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.""" |