async def rtm(self) -> AsyncIterator[Event]:
        """Connect to the realtime event API and start yielding events."""
        response = cast(RTMStart, await self.api("rtm.start"))

        self.me = Auto.generate(response.self_, "Me", recursive=False)
        self.team = Auto.generate(response.team, "Team", recursive=False)
        self.channels.fill(Channel.build(item) for item in response.channels)
        self.users.fill(User.build(item) for item in response.users)
        self.groups.fill(Group.build(item) for item in response.groups)

        log.debug(
            f"received {len(self.users)} users, {len(self.channels)} channels "
            f"and {len(self.groups)} groups from rtm.start"
        )

        async with self.session.ws_connect(response["url"]) as ws:
            async for msg in ws:
                event: Event = Event.generate(msg.json(), recursive=False)

                if event.type == "goodbye":
                    break

                yield event