Slight API modification, return value of connectionError allows to clear pending messages.