(SOLVED) Io.socket: 2 difference socket instances connect to 2 different cloud servers causing "internal routing confusion" within OH3


I have customised openhand-cloud to come out with a separate cloud connector (ABC connector) for my private Openhab Cloud. Both ABC connector and openhanded-cloud connector needs exist. However, it is so strange that remote view of “openhab UI” only possible if either one is active BUT not both. I instantiate socket with the following code and found out that replied traffic from either official Openhab-Cloud (myopenhab.org) or my private cloud take very long time to reach the following socket instance. So, my question is that is it possible to have 2 cloud instance (or 2 io.socket instances) within OH3?

     IO.Options options = new IO.Options();
            // options.forceNew = true;
            options.transports = new String[] { "websocket" };
            options.host = parsed.getHost();

            socket = IO.socket(baseURL, options);

I found the culprit. It has nothing to do with io.socket but the following delay method that halt the entire Io.Socket thread. Changing it to async scheduler method resolves the problem.

private void sleepSocketIO(long delay) {
        EventThread.exec(() -> {
            try {
            } catch (InterruptedException e) {


Yes… It was added some time ago for the reconnect delay. Probably scheduling socket.connect() (see here) using some scheduler would work as well, socket.io library uses similar mechanism socket.io-client-java/Manager.java at 89ef9d09cee799ffb85e0252bcaf1993f9d49af9 · socketio/socket.io-client-java · GitHub Not sure if this change would require some extra protection against race conditions, SocketClient.connect is part of the public interface and such could be in theory called while reconnect is in progress.

Would you like to open a PR?