I use an optical switch very similar to this one
Amazon product
And it works very well. Technically the old Arcam AVR200 I use it with does have 2 optical inputs but one of them is used by the tape monitor source which is awkward to use hence adding the switch. I've got a Chromecast audio and the optical output from my Plasma TV connected through the switch.
I've never used a co-ax version but I did use a standard RCA switcher with a mechanical switch to switch between co-ax digital with no issues in the dim and distant past