@defer.inlineCallbacks
    def join_room(self, room_name, sender, joinee):
        self._on_join(room_name, joinee)

        destinations = yield self.get_servers_for_context(room_name)

        try:
            pdu = Pdu.create_new(
                    context=room_name,
                    pdu_type="sy.room.member",
                    is_state=True,
                    state_key=joinee,
                    content={"membership": "join"},
                    origin=self.server_name,
                    destinations=destinations,
                )
            yield self.replication_layer.send_pdu(pdu)
        except Exception as e:
            logger.exception(e)
Join a room!
dataset/ETHPy150Open matrix-org/synapse/contrib/experiments/test_messaging.py/HomeServer.join_room