Optical sensor for continuous determination of halides