Hello,
I'm trying to make a Proxmox interface website for a school project, I have to give access to VMs and visualize them, handle permissions from my own interface... Here are the constraints :
Everything works fine except for the vm visualizer. As you know, I've to use wesockets to read VNC data and then transfer it to my client, so I basically have two websockets on a Ratchet server :
The point where I'm stuck is when I read data from the VM via the vncwebsocket endpoint. You can see here a part of my PHP code :
Here $fullUrl is for example :
Everything seems to work fine on the Proxmox side, as you can see on Proxmox logs :
But on the Ratchet server, nothing seems to be displayed, neither in the success or the error callback. After hours of research I couldn't find anything about this specific problem, so I'm sorry if someone already posted a similar issue.
Thanks in advance for your answer !
I'm trying to make a Proxmox interface website for a school project, I have to give access to VMs and visualize them, handle permissions from my own interface... Here are the constraints :
- I've to use PHP 8 and Symfony 6 for the server side.
- The client should never have access to the Proxmox API. My Symfony server makes a bridge between the client and the Proxmox API by using the Proxmox root user.
Everything works fine except for the vm visualizer. As you know, I've to use wesockets to read VNC data and then transfer it to my client, so I basically have two websockets on a Ratchet server :
- The first one to transmit data to the client and read his messages to transfer it to the second websocket.
- The second to read the vm data and transfer it to the client via the first websocket.
The point where I'm stuck is when I read data from the VM via the vncwebsocket endpoint. You can see here a part of my PHP code :
PHP:
// Connect the client
$reactConnector = new \React\Socket\Connector([
"tls" => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
]
]);
$connector = new \Ratchet\Client\Connector(connector: $reactConnector);
$connector($fullUrl, [], $headers)->then(
function (ConnectionInterface $conn) {
echo "Success handler called";
$conn->on('message', function($msg) use ($conn) {
echo "Received: {$msg}\n";
});
},
function () {
echo "Error handler called";
}
);
Here $fullUrl is for example :
wss://10.130.166.128:8006/api2/json/nodes/pocmox/qemu/207/vncwebsocket?port=5900&vncticket=PVEVNC%3A643EBCDA%3A%3AJQVHWtcpU%2FKk1ysolJ%2FM7satv4NkRceXDAIZEbw8vZwHsh8679nGAw%2BWaDYhk1E3zTF%2B9zmpwZG5EnPaq4zHaA068KpYmz17PIyEXZnNMLKQO8jo%2FGFPqMGVcTerf3vNWpqJX4rQj6mhzXjkNSQoS1sZSs35yZrGhw4oO2sgMlcPhkBb72l1MSUbv81%2FKAmictRTZuruIRZKJQHeQVcRHekDehNncwJL4GocHhVr1KJcGQen34XjJQAVX2lTXxpFPgjLTfQoNTvwbOhjn8%2BkZJFFN3bTNcLM6cYpUCRkrLpGzPwxZV5RlNdMzIvrHwzTKSs1%2FoH6LFfGW%2Fru7eUXjA%3D%3D
Everything seems to work fine on the Proxmox side, as you can see on Proxmox logs :
Code:
::ffff:10.130.166.128 - - [18/04/2023:17:52:58 +0200] "POST /api2/json/access/ticket?username=root@pam&password=<root password> HTTP/1.1" 200 704
::ffff:10.130.166.128 - root@pam [18/04/2023:17:52:58 +0200] "POST /api2/json/nodes/pocmox/qemu/207/vncproxy?generate-password=0&websocket=1 HTTP/1.1" 200 1976
::ffff:10.130.166.128 - root@pam [18/04/2023:17:52:59 +0200] "GET /api2/json/nodes/pocmox/qemu/207/vncwebsocket?port=5900&vncticket=PVEVNC%3A643EBCDA%3A%3AJQVHWtcpU%2FKk1ysolJ%2FM7satv4NkRceXDAIZEbw8vZwHsh8679nGAw%2BWaDYhk1E3zTF%2B9zmpwZG5EnPaq4zHaA068KpYmz17PIyEXZnNMLKQO8jo%2FGFPqMGVcTerf3vNWpqJX4rQj6mhzXjkNSQoS1sZSs35yZrGhw4oO2sgMlcPhkBb72l1MSUbv81%2FKAmictRTZuruIRZKJQHeQVcRHekDehNncwJL4GocHhVr1KJcGQen34XjJQAVX2lTXxpFPgjLTfQoNTvwbOhjn8%2BkZJFFN3bTNcLM6cYpUCRkrLpGzPwxZV5RlNdMzIvrHwzTKSs1%2FoH6LFfGW%2Fru7eUXjA%3D%3D HTTP/1.1" 101 -
But on the Ratchet server, nothing seems to be displayed, neither in the success or the error callback. After hours of research I couldn't find anything about this specific problem, so I'm sorry if someone already posted a similar issue.
Thanks in advance for your answer !