The VNCProxy route gives back a UPID for a given task---including VMs
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}/vncproxy
And then you can use the API to monitor the status. Perhaps, if we store the UPIDs of the VNC sessions, then once per minute or so, we check the status of all of them (might have to throttle if the API gets sad), and then use that to remove Websockify targets.
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/tasks/{upid}/status
The VNCProxy route gives back a UPID for a given task---including VMs
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}/vncproxy
And then you can use the API to monitor the status. Perhaps, if we store the UPIDs of the VNC sessions, then once per minute or so, we check the status of all of them (might have to throttle if the API gets sad), and then use that to remove Websockify targets.
https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/tasks/{upid}/status