Not sure if ktor websockets has anything to help with that, but here's some ideas:
• send the command to each server in your cluster over HTTP; servers not holding the target websocket will ignore it
• publish the active websockets to redis or any database, including the internal ip of the server holding it. Query for the internal ip and send the command to the server over HTTP
• write commands to a message broker; each server is subscribed and will process a duplicate of every command published; they will ignore the command if they aren't holding the target websocket
• If you're on AWS, replace your usage of ktor websocket with API Gateway websockets; it will handle the routing for you