def init_websocket(self, event_handler, websocket_cls=Websocket):
self.websocket = websocket_cls(self.options, self.client.token)<EOL>loop = asyncio.get_event_loop()<EOL>loop.run_until_complete(self.websocket.connect(event_handler))<EOL>return loop<EOL>
Will initialize the websocket connection to the mattermost server.

This should be run after login(), because the websocket needs to make
an authentification.

See https://api.mattermost.com/v4/#tag/WebSocket for which
websocket events mattermost sends.

Example of a really simple event_handler function

.. code:: python

        @asyncio.coroutine
        def my_event_handler(message):
                print(message)


:param event_handler: The function to handle the websocket events. Takes one argument.
:type event_handler: Function(message)
:return: The event loop