Only attempt to send a message if connected.