Every such charge as aforesaid shall [The liability of the insured may] be enforceable by way of an action against the insurer in the same way and in the same court as if the action were an action to recover damages or compensation from the insured; and in respect of any such action and of the judgment given therein the parties shall, to the extent of the charge, have the same rights and liabiliti