def connected(self):
        """
        If connected to server.
        """
        return self.websocket is not None and \
               self.websocket.sock is not None and \
               self.websocket.sock.connected
If connected to server.