def on_new_event(self, stream_key, new_token, users=[], rooms=[],
                     extra_streams=set()):
        with PreserveLoggingContext():
            user_streams = set()

            for user in users:
                user_stream = self.user_to_user_stream.get(str(user))
                if user_stream is not None:
                    user_streams.add(user_stream)

            for room in rooms:
                user_streams |= self.room_to_user_streams.get(room, set())

            time_now_ms = self.clock.time_msec()
            for user_stream in user_streams:
                try:
                    user_stream.notify(stream_key, new_token, time_now_ms)
                except:
                    logger.exception("Failed to notify listener")

            self.notify_replication()
Used to inform listeners that something has happend event wise.
dataset/ETHPy150Open matrix-org/synapse/synapse/notifier.py/Notifier.on_new_event