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

Websocket connection failed : WebSocket is closed before the connection is established. #13

Open
MeriemBo opened this issue Jun 19, 2019 · 7 comments

Comments

@MeriemBo
Copy link

Hello , I'm using the package in my angular 6 app , and the Webstocket is closed before the connection is established. here's my code :

import { Component, OnInit } from '@angular/core';
import { RemoteDesktopManager } from '@illgrenoble/ngx-remote-desktop';
import { WebSocketTunnel } from '@illgrenoble/guacamole-common-js';

@component({
selector: 'app-rdp',
templateUrl: './rdp.component.html',
styleUrls: ['./rdp.component.scss']
})
export class RDPComponent implements OnInit {
private manager: RemoteDesktopManager;
handleHelp() {
console.log('Hello help');
}
handleEnterFullScreen() {
this.manager.setFullScreen(true);
}

handleExitFullScreen() {
    this.manager.setFullScreen(false);
}

ngOnInit() {
    const tunnel = new WebSocketTunnel('ws://localhost:4200');
    this.manager = new RemoteDesktopManager(tunnel);
    const parameters = {
        ip: '120.18.13.142',
        port : 5000,
        type: 'rdp',
        image: 'image/png',
        width: window.screen.width,
        height: window.screen.height,
    };     
    this.manager.connect(parameters);
}

}
what am I doing wrong ?

@jamhall
Copy link
Contributor

jamhall commented Jun 19, 2019

Hi @MeriemBo !

Which websocket server are you using to proxy the connections to guacamole?

Are you using this one for testing: https://github.com/ILLGrenoble/guacamole-test-server ?

@MeriemBo
Copy link
Author

MeriemBo commented Jun 19, 2019

No , actually I'm not using that server for testing.I didn't know that I need an intermediate server.
I'll do my tests with the server you provided. but in case of production what server should I use ? thank you

@jamhall
Copy link
Contributor

jamhall commented Jun 19, 2019

@MeriemBo - Yups, you will need an intermediate server. The intermediate server will create a websocket connection. The websocket connection will establish a connection to guacd (guacamole server) and create the RDP/VNC connection to your chosen remote server. Once a connection has been established, the RDP/VNC data will be relayed over the websocket back to the client.
Alas, we have not open sourced a production server as we have a bit too much business logic for our own websocket implementation (we use a custom java socket.io server with JWT token authentication, database based role access and use an OpenStack API).

In regards to the test server: Modifying the code to use your own type of authentication/authorisation workflow shouldn't be too involved. Although it is a test server (I've tried to keep the code minimal), it should give you a good start to implement proper security policies for accessing your machines.

Good luck :-)

@MeriemBo
Copy link
Author

Thank you so much for your explanation.

@MeriemBo MeriemBo reopened this Jun 21, 2019
@MeriemBo
Copy link
Author

Hello, thank you again . I am doing my tests with the test server you provided , but I don't know exactly what are the changes that should be made in the code in order to make it work for my app.
Can you please clear that up ?

@tavoohoh
Copy link

tavoohoh commented Jul 2, 2019

Did you manage to solve it @MeriemBo? I'm having the same problem and I don't know anything about webSocket...

@divyeshg94
Copy link

Im using the test server mentioned above., But after the test server deployment, when it hit the IP:port its throwing 404., What am I missing.

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

No branches or pull requests

4 participants