async def connect(self):
proxy = os.environ.get('<STR_LIT>')<EOL>self._session = http_utils.Session(self._cookies, proxy=proxy)<EOL>try:<EOL><INDENT>self._channel = channel.Channel(<EOL>self._session, self._max_retries, self._retry_backoff_base<EOL>)<EOL>self._channel.on_connect.add_observer(self.on_connect.fire)<EOL>self._channel.on_reconnect.add_observer(self.on_reconnect.fire)<EOL>self._channel.on_disconnect.add_observer(self.on_disconnect.fire)<EOL>self._channel.on_receive_array.add_observer(self._on_receive_array)<EOL>self._listen_future = asyncio.ensure_future(self._channel.listen())<EOL>try:<EOL><INDENT>await self._listen_future<EOL><DEDENT>except asyncio.CancelledError:<EOL><INDENT>self._listen_future.cancel()<EOL><DEDENT>logger.info(<EOL>'<STR_LIT>'<EOL>)<EOL><DEDENT>finally:<EOL><INDENT>await self._session.close()<EOL><DEDENT>
Establish a connection to the chat server.

        Returns when an error has occurred, or :func:`disconnect` has been
        called.