diff --git a/socktop-wasm-test/Cargo.toml b/socktop-wasm-test/Cargo.toml deleted file mode 100644 index e69de29..0000000 diff --git a/socktop-wasm-test/README.md b/socktop-wasm-test/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/socktop-wasm-test/index.html b/socktop-wasm-test/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/socktop-wasm-test/src/lib.rs b/socktop-wasm-test/src/lib.rs deleted file mode 100644 index e69de29..0000000 diff --git a/socktop_wasm_test/index.html b/socktop_wasm_test/index.html index 1d698e9..3dde06a 100644 --- a/socktop_wasm_test/index.html +++ b/socktop_wasm_test/index.html @@ -23,6 +23,16 @@ } button:hover { background: #0757c7; } button:disabled { background: #ccc; cursor: not-allowed; } + .server-input { + margin: 10px 0; + padding: 8px; + width: 300px; + border: 1px solid #ddd; + border-radius: 4px; + font-family: monospace; + } + .input-group { margin: 15px 0; } + .input-group label { display: block; margin-bottom: 5px; font-weight: bold; } #output { border: 1px solid #ddd; border-radius: 4px; @@ -43,6 +53,12 @@

Status: Loading WASM module...

+
+ + +
+ @@ -111,9 +127,11 @@ testBtn.onclick = () => { testBtn.disabled = true; + const serverUrl = document.getElementById('server-url').value.trim(); addLog('=== Starting WASM Test ===', 'info'); + addLog(`🌐 Using server: ${serverUrl}`, 'info'); try { - test_socktop_connector(); + test_socktop_connector(serverUrl || undefined); setTimeout(() => { testBtn.disabled = false; }, 2000); diff --git a/socktop_wasm_test/src/lib.rs b/socktop_wasm_test/src/lib.rs index 2587049..8675951 100644 --- a/socktop_wasm_test/src/lib.rs +++ b/socktop_wasm_test/src/lib.rs @@ -16,13 +16,17 @@ macro_rules! console_log { // This is the main entry point called from JavaScript #[wasm_bindgen] -pub fn test_socktop_connector() { +pub fn test_socktop_connector(server_url: Option) { console_error_panic_hook::set_once(); + // Use provided URL or default + let url = server_url.unwrap_or_else(|| "ws://localhost:3000/ws".to_string()); + console_log!("🦀 Starting WASM connector test..."); + console_log!("🌐 Connecting to: {}", url); // Test 1: Create configuration - let config = ConnectorConfig::new("ws://localhost:3000/ws"); + let config = ConnectorConfig::new(&url); console_log!("✅ Config created: {}", config.url); // Test 2: Test configuration methods diff --git a/socktop_wasm_test/test.html b/socktop_wasm_test/test.html index 5a757b7..efe1112 100644 --- a/socktop_wasm_test/test.html +++ b/socktop_wasm_test/test.html @@ -39,6 +39,20 @@

This test demonstrates that socktop_connector works properly in WebAssembly with real WebSocket connections.

+
+ + + Edit if your socktop_agent is running on a different host/port +
+
@@ -47,22 +61,6 @@

Test Output:

Click "Run Test" to start...\n
-

Test Details:

- - -

Prerequisites:

- -