Check if we are connected before sending the message through the WebSocket