我正在使用ngx-remote-desktop软件包连接到外部桌面, 但我一直在控制台中收到错误消息:
与'ws:// localhost:4200 /?ip = 120.18.13.142&port = 5000&type = rdp&image = image / png&width = 1920&height = 1080'的WebSocket连接失败:WebSocket在建立连接之前已关闭。
这是我的代码:
@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);
}
}
我到底在做错什么?