You can get a digital optical switch, and if that is all it is, it would connect via a digital optical connection. Usually, they do not come with a cord to connect, so you will need one for that purpose.
But before you buy anything, you might want to explain what you are wanting to do, and what you have that you wish to hook together, as then you will likely get advice appropriate to your specific situation.