<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def _read_messages(self):
 """Process messages received on the WebSocket connection. Iteration terminates when the client is stopped or it disconnects. """

        while not self._stopped and self._websocket is not None:
            async for message in self._websocket:
                if message.type == aiohttp.WSMsgType.TEXT:
                    payload = message.json()
                    event = payload.pop("type", "Unknown")
                    self._dispatch_event(event, data=payload)
                elif message.type == aiohttp.WSMsgType.ERROR:
                    break