Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable WebSockets support #6

Open
bk138 opened this issue Jan 10, 2021 · 9 comments
Open

Enable WebSockets support #6

bk138 opened this issue Jan 10, 2021 · 9 comments
Labels
feature-request New feature or request

Comments

@bk138
Copy link
Owner

bk138 commented Jan 10, 2021

No description provided.

@bk138 bk138 added the feature-request New feature or request label Jan 10, 2021
@Yonle
Copy link

Yonle commented Apr 22, 2021

There's a project called noVNC. You can try it.

@bk138
Copy link
Owner Author

bk138 commented Apr 22, 2021

There's a project called noVNC. You can try it.

I know it and worked with it. It's a client. I was htinking about LibVNCServer here.

@Yonle
Copy link

Yonle commented Apr 23, 2021

For Alternative way, Convert TCP into WS, Because noVNC Websockify is doing that.

@bk138
Copy link
Owner Author

bk138 commented Apr 23, 2021

LibVNCServer has native WebSockets support, so this issue here should be easy to tackle.

@Yonle
Copy link

Yonle commented Apr 24, 2021

Ah yes! You're right!

@wozuo
Copy link

wozuo commented Sep 8, 2021

Hi @bk138 any progress on this? I'm trying to implement the websockets support using LibVNCServer but the HTTP connections are not reaching the HTTP server somehow... (the VNC server over TCP works though)
So what I've tried so far is copying the contents of the webclients dir from the assets folder to external storage /storage/emulated/0/webclients on startup of the app (just for testing). And in droidvnc-ng.c I'm setting:

theScreen->alwaysShared = TRUE;
theScreen->httpDir = "/storage/emulated/0/webclients";
theScreen->httpEnableProxyConnect = TRUE;
theScreen->httpPort = 8080;
theScreen->http6Port = 8080;

and after rbInitServer(theScreen) I'm checking the sockets:

if(theScreen->httpListenSock == RFB_INVALID_SOCKET || theScreen->httpListen6Sock == RFB_INVALID_SOCKET) {
        __android_log_print(ANDROID_LOG_ERROR, TAG, "vncStartServer: httpListenSock failed starting (%s)", strerror(errno));
        Java_net_christianbeier_droidvnc_1ng_MainService_vncStopServer(env, thiz);
        return JNI_FALSE;
    }

The console prints:

 Listening for HTTP connections on TCP port 8080
      URL http://localhost:8080
    Listening for HTTP connections on TCP6 port 8080
      URL http://localhost:8080
    vncStartServer: successfully started

as if everything is running fine, but if I try to connect to http://ipofmyphone:8080 via the browser the requests seem to not even reach the app (no log output, etc. it just loads forever). Any ideas?

@bk138
Copy link
Owner Author

bk138 commented Sep 8, 2021

I can at for the time being only point you at https://github.com/LibVNC/libvncserver#using-websockets for a working WebSockets example, I won't be able to spend time on this here issue in the upcoming weeks.

@wozuo
Copy link

wozuo commented Sep 8, 2021

@bk138 thanks for the quick reply, yea I implemented it using the example described in the LibVNCServer readme. No worries I'll let you know if I find something to get it to work!

@Scisaga
Copy link

Scisaga commented Feb 5, 2022

  1. update libvncserver code according to httpd: allow websockets VNC connection on http port if run with -enablehttpproxy LibVNC/libvncserver#492, re make & run app in your phone,
  2. try to connect http://ipofmyphone:5900/ with novnc, 5900 is default vnc port, you may found remote window in your browser,
  3. i guess libvncserver implemented some port multiplexing mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants