check websocket connection before sending messages