I have x11vnc running inside a docker container with alpine as base image. (5900 is exposed and mapped to hosts 5900) I use Xvfb as well. I run x11vnc inside the container using this command
x11vnc -display :0 -forever -nopw -listen 0.0.0.0 -xkb
I can connect to ths normally using a normal vnc client like realvnc without any issue and any unusual delay. This is the output when real vnc is used
24/09/2024 15:42:00 Got connection from client 112.134.157.141
24/09/2024 15:42:00 0 other clients
24/09/2024 15:42:00 Normal socket connection
24/09/2024 15:42:00 Disabled X server key autorepeat.
24/09/2024 15:42:00 to force back on run: 'xset r on' (3 times)
24/09/2024 15:42:00 incr accepted_client=2 for 112.134.157.141:48624 sock=10
24/09/2024 15:42:01 Client Protocol Version 3.8
24/09/2024 15:42:01 Protocol version sent 3.8, using 3.8
24/09/2024 15:42:01 rfbProcessClientSecurityType: executing handler for type 1
24/09/2024 15:42:01 rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.8
24/09/2024 15:42:01 created xdamage object: 0xc00026
24/09/2024 15:42:03 client_set_net: 112.134.157.141 0.0016
24/09/2024 15:42:03 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x00000018)
24/09/2024 15:42:03 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x00000016)
24/09/2024 15:42:03 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x00000015)
24/09/2024 15:42:03 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x0000000F)
24/09/2024 15:42:03 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFEC6)
24/09/2024 15:42:03 Enabling full-color cursor updates for client 112.134.157.141
24/09/2024 15:42:03 Enabling NewFBSize protocol extension for client 112.134.157.141
24/09/2024 15:42:03 Using ZRLE encoding for client 112.134.157.141
24/09/2024 15:42:03 Pixel format for client 112.134.157.141:
24/09/2024 15:42:03 8 bpp, depth 6
24/09/2024 15:42:03 true colour: max r 3 g 3 b 3, shift r 4 g 2 b 0
But when i try to connect it through react-vnc (which uses noVNC) It takes a long time to connect
This is the output from x11vnc when attempting to connect with react-vnc, it get stuck at “created xdamage object: 0xc00027” for about 4 mins.
24/09/2024 15:42:43 Got connection from client 112.134.157.141
24/09/2024 15:42:43 0 other clients
24/09/2024 15:42:43 Got 'ws' WebSockets handshake
24/09/2024 15:42:43 - webSocketsHandshake: using binary/raw encoding
24/09/2024 15:42:43 - WebSockets client version hybi-13
24/09/2024 15:42:43 Disabled X server key autorepeat.
24/09/2024 15:42:43 to force back on run: 'xset r on' (3 times)
24/09/2024 15:42:43 incr accepted_client=3 for 112.134.157.141:47494 sock=10
24/09/2024 15:42:43 created xdamage object: 0xc00027
24/09/2024 15:46:42 hybiReadHeader: read; Connection reset by peer
24/09/2024 15:46:42 rfbProcessClientProtocolVersion: read: Connection reset by peer
24/09/2024 15:46:42 client_count: 0
24/09/2024 15:46:42 Restored X server key autorepeat to: 1
24/09/2024 15:46:42 Client 112.134.157.141 gone
24/09/2024 15:46:42 Statistics events Transmit/ RawEquiv ( saved)
24/09/2024 15:46:42 TOTALS : 0 | 0/ 0 ( 0.0%)
24/09/2024 15:46:42 Statistics events Received/ RawEquiv ( saved)
24/09/2024 15:46:42 TOTALS : 0 | 0/ 0 ( 0.0%)
24/09/2024 15:46:45 destroyed xdamage object: 0xc00027
This is what the next.js implementation looks like.
"use client";
import React, { useRef } from 'react';
import { VncScreen } from 'react-vnc';
function App() {
const ref = useRef();
return (
<VncScreen
url='ws://<vps_ip>:5900/'
scaleViewport
background="#000000"
style={{
width: '100vw',
height: '100vh',
}}
ref={ref}
/>
);
}
export default App;
in chrome i also get this warning
"index.es.js:9621 WebSocket connection to 'ws://<vps_ip>:5900/' failed: WebSocket is closed before the connection is established.
close @ index.es.js:9621
"
Is this normal, if not how to fix
1