check if connection is open before publishing message in transport client