@asyncio.coroutine<EOL><INDENT>def connect(self, event_handler):<DEDENT>
context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)<EOL>if not self.options['<STR_LIT>']:<EOL><INDENT>context.verify_mode = ssl.CERT_NONE<EOL><DEDENT>scheme = '<STR_LIT>'<EOL>if self.options['<STR_LIT>'] != '<STR_LIT>':<EOL><INDENT>scheme = '<STR_LIT>'<EOL>context = None<EOL><DEDENT>url = '<STR_LIT>'.format(<EOL>scheme=scheme,<EOL>url=self.options['<STR_LIT:url>'],<EOL>port=str(self.options['<STR_LIT:port>']),<EOL>basepath=self.options['<STR_LIT>']<EOL>)<EOL>websocket = yield from websockets.connect(<EOL>url,<EOL>ssl=context,<EOL>)<EOL>yield from self._authenticate_websocket(websocket, event_handler)<EOL>yield from self._start_loop(websocket, event_handler)<EOL>
Connect to the websocket and authenticate it.
When the authentication has finished, start the loop listening for messages,
sending a ping to the server to keep the connection alive.

:param event_handler: Every websocket event will be passed there. Takes one argument.
:type event_handler: Function(message)
:return: