def send(self, data):
        """Send message to the server
        :param str data: message.
        """
        if not self._ws_connection:
            raise RuntimeError('Web socket connection is closed.')

        self._ws_connection.write_message(escape.utf8(json.dumps(data)))
Send message to the server
        :param str data: message.
        
recipes/Python/579076_Simple_Web_socket_client_implementatiusing/recipe-579076.py