Пример #1
0
    def set_room_custom_attributes(self, room_name: str, custom_attributes: Mapping[str, Any]):
        with self._mutex:
            if room_name not in self._rooms:
                logger.warning("Room %s does not exist.", room_name)
                return

            diff = update_attributes_and_get_diff(self._rooms[room_name].custom_attributes, custom_attributes)
            self.broadcast_room_update(self._rooms[room_name], diff)
Пример #2
0
    def set_client_attributes(self, attributes: dict):
        diff = update_attributes_and_get_diff(self.current_custom_attributes, attributes)
        if diff == {}:
            return True

        return self.send_command(
            common.Command(common.MessageType.SET_CLIENT_CUSTOM_ATTRIBUTES, common.encode_json(diff), 0)
        )
Пример #3
0
 def _set_custom_attributes(custom_attributes: Mapping[str, Any]):
     diff = update_attributes_and_get_diff(self.custom_attributes, custom_attributes)
     self._server.broadcast_client_update(self, diff)