Was massively done* at outbreak of WWI (1914, not 1917). UK was a major telegraph hub. Prior to that Churchill had set up spying on all international traffic. The precursor to Bletchley & GCHQ.
[*The UK cut any cables that would be of use to Germans and their allies.]