This sounds like a welcome addition in a PR!
________________________________
From: Umit Eyigun <[email protected]>
Sent: 30 September 2026 10:28
To: [email protected] <[email protected]>
Subject: [console proxy] Allow more than one simultaneous noVNC viewer on the 
same instance

Hello,

On Apache CloudStack 4.23.0.0 the console proxy keeps a single noVNC viewer per 
instance. When a second person opens the console, ConsoleProxy.getNoVncViewer() 
disconnects the existing WebSocket and replaces it. The log line is 
"Initializing new novnc client and disconnecting existing session".

That matches the choice made in PR 4531 (accept the new session and drop the 
old one). For a shared operations console it is a problem: a colleague opening 
the same instance drops the person who is already working. On VMware this is 
not forced by the hypervisor. Each createConsoleEndpoint already receives its 
own ticket (wss://<esxi>/ticket/<id>). sessionRequiresNewViewer stays false on 
that path, so getClientMapKey() is the instance UUID and every new browser hits 
the same map entry.

We changed only the branch that used to kick the current viewer. The existing 
client stays in connectionMap. The new client is stored under its session UUID, 
authenticates on its own, and opens its own hypervisor websocket.

    LOGGER.info("Adding extra novnc viewer without disconnecting existing 
session for " + clientKey);
    ConsoleProxyNoVncClient extraViewer = new ConsoleProxyNoVncClient(session);
    extraViewer.initClient(param);
    String extraKey = param.getSessionUuid();
    if (extraKey == null || extraKey.isEmpty()) {
        extraKey = clientKey + "-extra-" + System.nanoTime();
    }
    connectionMap.put(extraKey, extraViewer);
    viewer = extraViewer;
    reportLoadChange = true;

The removed part was getSession().disconnect(), removeViewer(viewer), and 
putting the new client back on the same VM key.

Tested on 4.23.0.0 with VMware. Two console endpoints to the same running 
instance: both WebSockets completed the handshake, both received RFB 003.008, 
and the console proxy logged "Adding extra novnc viewer without disconnecting 
existing session" instead of disconnecting the first client.

Keyboard and mouse from both viewers are delivered to the guest, so two people 
can type at once. If the project wants the current kick behavior to remain the 
default, this fits behind a setting such as 
consoleproxy.novnc.allow.multiple.viewers (default false). We can send a PR in 
that shape.

Thank you,
Umit Eyigun
[email protected]

Reply via email to