I understand your point on wanting to keep the client code untouched.
Not sure how much
websocket.io handles at the backend part, but if the client doesn’t have special conventions, it might work with the ktor server implementation.
As far as I am aware, right now you cannot plug an external websocket implementation to the ktor server.
Regarding to multiplexing and reconnection.
Multiplexing already happens in the way that you can send and receive websocket frames at any point. They will be queued and sent in order asap and received as long as they are read from the socket.
Reconnection usually happens at client-side by recreating the object, since WebSocket doesn’t have a reconnect/connect method. There are small decorators for that:
https://github.com/joewalnes/reconnecting-websocket
Usually reconnection also means persisting the state. There is a sample persisting some state in ktor using a session here:
https://github.com/ktorio/ktor-samples/tree/master/app/chat
If the
websocket.io backend part requires some ceremony, it won’t work at this point. Depending on their implementation and if their implementation can reuse an already opened socket would be possible to modify ktor to allow external websocket implementations. But this would require some time.