Fix WebAssembly module access - use synchronous Module object

- WallixModule is not a Promise, Module is the global WebAssembly object
- Check if newRdpGraphics2D is defined before using it
- Use Module.RdpClient directly like in rdpwasm/mstsc.js
- Rebuild project to embed updated HTML template
parent 585c3956
...@@ -304,33 +304,34 @@ function connect() { ...@@ -304,33 +304,34 @@ function connect() {
socket.binaryType = 'arraybuffer'; socket.binaryType = 'arraybuffer';
socket.onopen = () => { socket.onopen = () => {
// Wait for WebAssembly module to be ready // Check if WebAssembly module functions are available
WallixModule.then((module) => { if (typeof newRdpGraphics2D === 'undefined') {
const canvas = document.getElementById('canvas'); console.error('WebAssembly RDP functions not loaded');
const gd = newRdpGraphics2D(canvas, module); showNotification('Failed to load RDP client', 'danger');
const config = {
width: 1024,
height: 768,
username: '',
password: '',
domain: '',
bpp: 32,
verbosity: 0
};
rdpclient = new module.RdpClient(gd, config);
rdpclient.writeFirstPacket();
sendData();
connected = true;
document.getElementById('connectBtn').disabled = true;
document.getElementById('disconnectBtn').disabled = false;
// Hide loading message
document.getElementById('rdp_loading').style.display = 'none';
showNotification('RDP session connected', 'success');
}).catch((error) => {
console.error('Failed to initialize WebAssembly module:', error);
showNotification('Failed to initialize RDP client', 'danger');
disconnect(); disconnect();
}); return;
}
const canvas = document.getElementById('canvas');
const gd = newRdpGraphics2D(canvas, Module);
const config = {
width: 1024,
height: 768,
username: '',
password: '',
domain: '',
bpp: 32,
verbosity: 0
};
rdpclient = new Module.RdpClient(gd, config);
rdpclient.writeFirstPacket();
sendData();
connected = true;
document.getElementById('connectBtn').disabled = true;
document.getElementById('disconnectBtn').disabled = false;
// Hide loading message
document.getElementById('rdp_loading').style.display = 'none';
showNotification('RDP session connected', 'success');
}; };
socket.onmessage = (event) => { socket.onmessage = (event) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment