docs: Complete WASM documentation update - reflect full networking capabilities
This commit is contained in:
parent
22c1f80e70
commit
49164da105
29
Cargo.lock
generated
29
Cargo.lock
generated
@ -2213,10 +2213,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "socktop_connector"
|
||||
version = "0.1.3"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"futures-util",
|
||||
"js-sys",
|
||||
"prost",
|
||||
"prost-build",
|
||||
"protoc-bin-vendored",
|
||||
@ -2228,6 +2229,9 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-tungstenite 0.24.0",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2800,6 +2804,19 @@ dependencies = [
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.100"
|
||||
@ -2832,6 +2849,16 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.77"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.4.2"
|
||||
|
||||
0
socktop-wasm-test/Cargo.toml
Normal file
0
socktop-wasm-test/Cargo.toml
Normal file
0
socktop-wasm-test/README.md
Normal file
0
socktop-wasm-test/README.md
Normal file
0
socktop-wasm-test/index.html
Normal file
0
socktop-wasm-test/index.html
Normal file
0
socktop-wasm-test/src/lib.rs
Normal file
0
socktop-wasm-test/src/lib.rs
Normal file
452
socktop_wasm_test/Cargo.lock
generated
452
socktop_wasm_test/Cargo.lock
generated
@ -2,12 +2,33 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "adler2"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.99"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.19.0"
|
||||
@ -36,12 +57,59 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||
|
||||
[[package]]
|
||||
name = "fixedbitset"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.16"
|
||||
@ -51,10 +119,44 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"wasi",
|
||||
"wasi 0.11.1+wasi-snapshot-preview1",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasi 0.14.4+wasi-0.2.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.14.0"
|
||||
@ -86,6 +188,12 @@ version = "0.2.175"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.28"
|
||||
@ -98,12 +206,47 @@ version = "2.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multimap"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
|
||||
[[package]]
|
||||
name = "petgraph"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.101"
|
||||
@ -123,6 +266,26 @@ dependencies = [
|
||||
"prost-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prost-build"
|
||||
version = "0.13.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"itertools",
|
||||
"log",
|
||||
"multimap",
|
||||
"once_cell",
|
||||
"petgraph",
|
||||
"prettyplease",
|
||||
"prost",
|
||||
"prost-types",
|
||||
"regex",
|
||||
"syn",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prost-derive"
|
||||
version = "0.13.5"
|
||||
@ -136,6 +299,79 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prost-types"
|
||||
version = "0.13.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16"
|
||||
dependencies = [
|
||||
"prost",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "protoc-bin-vendored"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1c381df33c98266b5f08186583660090a4ffa0889e76c7e9a5e175f645a67fa"
|
||||
dependencies = [
|
||||
"protoc-bin-vendored-linux-aarch_64",
|
||||
"protoc-bin-vendored-linux-ppcle_64",
|
||||
"protoc-bin-vendored-linux-s390_64",
|
||||
"protoc-bin-vendored-linux-x86_32",
|
||||
"protoc-bin-vendored-linux-x86_64",
|
||||
"protoc-bin-vendored-macos-aarch_64",
|
||||
"protoc-bin-vendored-macos-x86_64",
|
||||
"protoc-bin-vendored-win32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "protoc-bin-vendored-linux-aarch_64"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c350df4d49b5b9e3ca79f7e646fde2377b199e13cfa87320308397e1f37e1a4c"
|
||||
|
||||
[[package]]
|
||||
name = "protoc-bin-vendored-linux-ppcle_64"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a55a63e6c7244f19b5c6393f025017eb5d793fd5467823a099740a7a4222440c"
|
||||
|
||||
[[package]]
|
||||
name = "protoc-bin-vendored-linux-s390_64"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1dba5565db4288e935d5330a07c264a4ee8e4a5b4a4e6f4e83fad824cc32f3b0"
|
||||
|
||||
[[package]]
|
||||
name = "protoc-bin-vendored-linux-x86_32"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8854774b24ee28b7868cd71dccaae8e02a2365e67a4a87a6cd11ee6cdbdf9cf5"
|
||||
|
||||
[[package]]
|
||||
name = "protoc-bin-vendored-linux-x86_64"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b38b07546580df720fa464ce124c4b03630a6fb83e05c336fea2a241df7e5d78"
|
||||
|
||||
[[package]]
|
||||
name = "protoc-bin-vendored-macos-aarch_64"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89278a9926ce312e51f1d999fee8825d324d603213344a9a706daa009f1d8092"
|
||||
|
||||
[[package]]
|
||||
name = "protoc-bin-vendored-macos-x86_64"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81745feda7ccfb9471d7a4de888f0652e806d5795b61480605d4943176299756"
|
||||
|
||||
[[package]]
|
||||
name = "protoc-bin-vendored-win32"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95067976aca6421a523e491fce939a3e65249bac4b977adee0ee9771568e8aa3"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.40"
|
||||
@ -145,6 +381,54 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "5.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.22"
|
||||
@ -189,16 +473,37 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socktop_connector"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a63dadaa5105df11b0684759a829012257d48e72a469cc554c0cf4394605f5a"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"js-sys",
|
||||
"prost",
|
||||
"prost-build",
|
||||
"protoc-bin-vendored",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socktop_wasm_test"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"getrandom",
|
||||
"prost",
|
||||
"getrandom 0.2.16",
|
||||
"js-sys",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"socktop_connector",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
@ -213,6 +518,39 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"getrandom 0.3.3",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.18"
|
||||
@ -225,6 +563,15 @@ version = "0.11.1+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.14.4+wasi-0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88a5f4a424faf49c3c2c344f166f0662341d470ea185e939657aaff130f0ec4a"
|
||||
dependencies = [
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.101"
|
||||
@ -252,6 +599,19 @@ dependencies = [
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ca85039a9b469b38336411d6d6ced91f3fc87109a2a27b0c197663f5144dffe"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.101"
|
||||
@ -293,3 +653,89 @@ dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.60.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.53.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.45.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c573471f125075647d03df72e026074b7203790d41351cd6edc96f46bcccd36"
|
||||
|
||||
@ -10,23 +10,27 @@ edition = "2021"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
# Only include the types and configuration, not the networking
|
||||
# Use WASM features for WebSocket connectivity (published version)
|
||||
socktop_connector = { version = "0.1.5", default-features = false, features = ["wasm"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
console_error_panic_hook = "0.1"
|
||||
js-sys = "0.3"
|
||||
|
||||
# For manual protobuf handling if needed
|
||||
prost = "0.13"
|
||||
[dependencies.web-sys]
|
||||
version = "0.3"
|
||||
features = [
|
||||
"console",
|
||||
"WebSocket",
|
||||
"MessageEvent",
|
||||
"ErrorEvent",
|
||||
"CloseEvent",
|
||||
"BinaryType",
|
||||
]
|
||||
|
||||
# Enable JS feature for WASM random number generation
|
||||
[dependencies.getrandom]
|
||||
version = "0.2"
|
||||
features = ["js"]
|
||||
|
||||
# WASM-specific dependencies
|
||||
[dependencies.web-sys]
|
||||
version = "0.3"
|
||||
features = [
|
||||
"console",
|
||||
]
|
||||
|
||||
@ -4,21 +4,23 @@ This directory contains a complete WebAssembly (WASM) compatibility test and imp
|
||||
|
||||
## Overview
|
||||
|
||||
`socktop_connector` provides **types-only support** for WebAssembly environments. While the networking functionality requires tokio/mio (which don't work in WASM), the core types can be used for serialization and configuration with browser WebSocket APIs.
|
||||
`socktop_connector` provides **full WebSocket networking support** for WebAssembly environments. The library includes complete connectivity functionality with automatic compression and protobuf decoding, making it easy to connect to socktop agents directly from browser applications.
|
||||
|
||||
## What Works in WASM
|
||||
|
||||
- ✅ **Full WebSocket connections** (`ws://` connections)
|
||||
- ✅ **All request types** (`AgentRequest::Metrics`, `AgentRequest::Disks`, `AgentRequest::Processes`)
|
||||
- ✅ **Automatic data processing**: Gzip decompression for metrics/disks, protobuf decoding for processes
|
||||
- ✅ Configuration types (`ConnectorConfig`)
|
||||
- ✅ Request/Response types (`AgentRequest`, `AgentResponse`)
|
||||
- ✅ JSON serialization/deserialization of all types
|
||||
- ✅ Protocol and version configuration builders
|
||||
- ✅ All type-safe validation and error handling for configurations
|
||||
- ✅ All type-safe validation and error handling
|
||||
|
||||
## What Doesn't Work in WASM
|
||||
|
||||
- ❌ Direct WebSocket connections (tokio/mio incompatibility)
|
||||
- ❌ TLS certificate handling (rustls incompatibility)
|
||||
- ❌ All networking functionality (`connect_to_socktop_agent*` functions)
|
||||
- ❌ TLS connections (`wss://`) - use `ws://` only
|
||||
- ❌ TLS certificate handling (use non-TLS endpoints)
|
||||
|
||||
## Quick Test
|
||||
|
||||
@ -35,27 +37,22 @@ basic-http-server . --addr 127.0.0.1:8000
|
||||
|
||||
## WASM Dependencies
|
||||
|
||||
The test uses minimal dependencies that work in WASM:
|
||||
The test uses the WASM-compatible networking features:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
socktop_connector = { path = "../socktop_connector", default-features = false }
|
||||
socktop_connector = { version = "0.1.5", default-features = false, features = ["wasm"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
wasm-bindgen = "0.2"
|
||||
console_error_panic_hook = "0.1"
|
||||
prost = "0.13" # For protobuf compatibility testing
|
||||
|
||||
[dependencies.getrandom]
|
||||
version = "0.2"
|
||||
features = ["js"] # Enable browser random number generation
|
||||
|
||||
[dependencies.web-sys]
|
||||
version = "0.3"
|
||||
features = ["console"] # For console.log
|
||||
features = ["console"]
|
||||
```
|
||||
|
||||
**Critical**: Use `default-features = false` to exclude tokio and rustls dependencies that don't work in WASM.
|
||||
**Key**: Use `features = ["wasm"]` to enable full WebSocket networking support in WASM builds.
|
||||
|
||||
## Implementation Strategy
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
<li>❌ <strong>Failure:</strong> Build errors or TLS dependency issues</li>
|
||||
</ul>
|
||||
|
||||
<p><small>💡 <strong>Tip:</strong> To test with real data, start socktop_agent with: <code>cargo run --bin socktop_agent -- --no-tls --port 3000</code></small></p>
|
||||
<p><small>💡 <strong>Tip:</strong> start socktop_agent with: <code>socktop_agent --port 3000</code></small></p>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use wasm_bindgen_futures::spawn_local;
|
||||
use socktop_connector::{ConnectorConfig, AgentRequest, SocktopConnector};
|
||||
|
||||
// Import the `console.log` function from the browser
|
||||
// Import the `console.log` function from the Web API
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(js_namespace = console)]
|
||||
@ -13,59 +14,16 @@ macro_rules! console_log {
|
||||
($($t:tt)*) => (log(&format_args!($($t)*).to_string()))
|
||||
}
|
||||
|
||||
// Replicate the core types from socktop_connector for WASM use
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct WasmConnectorConfig {
|
||||
pub url: String,
|
||||
pub ws_version: Option<String>,
|
||||
pub ws_protocols: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum WasmAgentRequest {
|
||||
Metrics,
|
||||
Processes,
|
||||
Disks,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct WasmMetrics {
|
||||
pub hostname: String,
|
||||
pub cpu_total: f64,
|
||||
pub mem_used: u64,
|
||||
pub mem_total: u64,
|
||||
}
|
||||
|
||||
impl WasmConnectorConfig {
|
||||
pub fn new(url: impl Into<String>) -> Self {
|
||||
Self {
|
||||
url: url.into(),
|
||||
ws_version: None,
|
||||
ws_protocols: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_version(mut self, version: String) -> Self {
|
||||
self.ws_version = Some(version);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_protocols(mut self, protocols: Vec<String>) -> Self {
|
||||
self.ws_protocols = Some(protocols);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
// This is the main entry point called from JavaScript
|
||||
#[wasm_bindgen]
|
||||
pub fn test_socktop_connector() {
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
console_log!("🦀 Starting WASM-native socktop test...");
|
||||
console_log!("🦀 Starting WASM connector test...");
|
||||
|
||||
// Test 1: Create configuration (no networking dependencies)
|
||||
let config = WasmConnectorConfig::new("ws://localhost:3000/ws");
|
||||
console_log!("✅ WasmConnectorConfig created: {}", config.url);
|
||||
// Test 1: Create configuration
|
||||
let config = ConnectorConfig::new("ws://localhost:3000/ws");
|
||||
console_log!("✅ Config created: {}", config.url);
|
||||
|
||||
// Test 2: Test configuration methods
|
||||
let config_with_protocols = config
|
||||
@ -73,53 +31,154 @@ pub fn test_socktop_connector() {
|
||||
.with_protocols(vec!["socktop".to_string(), "v1".to_string()]);
|
||||
console_log!("✅ Config with protocols: {:?}", config_with_protocols.ws_protocols);
|
||||
|
||||
let config_with_version = config
|
||||
.with_version("13".to_string());
|
||||
let config_with_version = config_with_protocols.with_version("13".to_string());
|
||||
console_log!("✅ Config with version: {:?}", config_with_version.ws_version);
|
||||
|
||||
// Test 3: Create request types
|
||||
let _metrics_request = WasmAgentRequest::Metrics;
|
||||
let _process_request = WasmAgentRequest::Processes;
|
||||
let _disk_request = WasmAgentRequest::Disks;
|
||||
console_log!("✅ Request types created successfully");
|
||||
let _metrics_request = AgentRequest::Metrics;
|
||||
let _disks_request = AgentRequest::Disks;
|
||||
let _processes_request = AgentRequest::Processes;
|
||||
console_log!("✅ AgentRequest types created");
|
||||
|
||||
// Test 4: Test serialization (important for WASM interop)
|
||||
match serde_json::to_string(&_metrics_request) {
|
||||
Ok(json) => console_log!("✅ Request serialization works: {}", json),
|
||||
Err(e) => console_log!("❌ Serialization failed: {}", e),
|
||||
// Test 4: Test serialization
|
||||
if let Ok(json) = serde_json::to_string(&AgentRequest::Metrics) {
|
||||
console_log!("✅ Serialization works: {}", json);
|
||||
}
|
||||
|
||||
// Test 5: Test example metrics deserialization
|
||||
let sample_metrics = WasmMetrics {
|
||||
hostname: "wasm-test-host".to_string(),
|
||||
cpu_total: 45.2,
|
||||
mem_used: 8_000_000_000,
|
||||
mem_total: 16_000_000_000,
|
||||
};
|
||||
// Test 5: WebSocket connection test
|
||||
console_log!("🌐 Testing WebSocket connection...");
|
||||
|
||||
match serde_json::to_string(&sample_metrics) {
|
||||
Ok(json) => {
|
||||
console_log!("✅ Metrics serialization: {}", json);
|
||||
spawn_local(async move {
|
||||
test_websocket_connection(config_with_version).await;
|
||||
|
||||
// Test round-trip
|
||||
match serde_json::from_str::<WasmMetrics>(&json) {
|
||||
Ok(parsed) => console_log!("✅ Round-trip successful: hostname={}", parsed.hostname),
|
||||
Err(e) => console_log!("❌ Deserialization failed: {}", e),
|
||||
console_log!("");
|
||||
console_log!("🎉 socktop_connector WASM Test Results:");
|
||||
console_log!("✅ ConnectorConfig API works in WASM");
|
||||
console_log!("✅ AgentRequest types work in WASM");
|
||||
console_log!("✅ SocktopConnector compiles for WASM");
|
||||
console_log!("✅ Connection stays alive with regular requests");
|
||||
});
|
||||
}
|
||||
|
||||
async fn test_websocket_connection(config: ConnectorConfig) {
|
||||
console_log!("📡 Connecting to agent...");
|
||||
|
||||
let mut connector = SocktopConnector::new(config);
|
||||
|
||||
match connector.connect().await {
|
||||
Ok(()) => {
|
||||
console_log!("✅ Connected!");
|
||||
|
||||
// Test continuous monitoring (5 rounds)
|
||||
for round in 1..=5 {
|
||||
console_log!("🔄 Round {}/5 - Requesting metrics...", round);
|
||||
|
||||
// Request metrics (mimicking TUI behavior)
|
||||
match connector.request(AgentRequest::Metrics).await {
|
||||
Ok(response) => {
|
||||
match &response {
|
||||
socktop_connector::AgentResponse::Metrics(metrics) => {
|
||||
console_log!("✅ Round {} - CPU: {:.1}%, Mem: {:.1}%, Host: {}",
|
||||
round,
|
||||
metrics.cpu_total,
|
||||
(metrics.mem_used as f64 / metrics.mem_total as f64) * 100.0,
|
||||
metrics.hostname
|
||||
);
|
||||
|
||||
// Show JSON summary for each round (clean, collapsible)
|
||||
if let Ok(json_str) = serde_json::to_string_pretty(&response) {
|
||||
console_log!("📊 Round {} JSON ({} chars):", round, json_str.len());
|
||||
console_log!("{}", json_str);
|
||||
}
|
||||
},
|
||||
_ => console_log!("📊 Round {} - Received non-metrics response", round),
|
||||
}
|
||||
}
|
||||
Err(e) => console_log!("❌ Metrics serialization failed: {}", e),
|
||||
Err(e) => {
|
||||
console_log!("❌ Round {} failed: {}", round, e);
|
||||
console_log!("🔍 Error details: {:?}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Every other round, also test disks and processes
|
||||
if round % 2 == 0 {
|
||||
console_log!("💾 Round {} - Requesting disk info...", round);
|
||||
match connector.request(AgentRequest::Disks).await {
|
||||
Ok(response) => {
|
||||
match &response {
|
||||
socktop_connector::AgentResponse::Disks(disks) => {
|
||||
console_log!("✅ Round {} - Got {} disks", round, disks.len());
|
||||
for disk in disks.iter().take(3) { // Show first 3 disks
|
||||
let used_gb = (disk.total - disk.available) / 1024 / 1024 / 1024;
|
||||
let total_gb = disk.total / 1024 / 1024 / 1024;
|
||||
console_log!(" 💿 {}: {}/{} GB used", disk.name, used_gb, total_gb);
|
||||
}
|
||||
},
|
||||
_ => console_log!("❌ Round {} - Unexpected disk response type", round),
|
||||
}
|
||||
},
|
||||
Err(e) => console_log!("❌ Round {} - Disk request failed: {}", round, e),
|
||||
}
|
||||
|
||||
console_log!("⚙️ Round {} - Requesting process info...", round);
|
||||
match connector.request(AgentRequest::Processes).await {
|
||||
Ok(response) => {
|
||||
match &response {
|
||||
socktop_connector::AgentResponse::Processes(processes) => {
|
||||
console_log!("✅ Round {} - Process count: {}, Top processes: {}",
|
||||
round,
|
||||
processes.process_count,
|
||||
processes.top_processes.len()
|
||||
);
|
||||
if processes.top_processes.is_empty() {
|
||||
console_log!("ℹ️ No top processes in response (process_count: {})", processes.process_count);
|
||||
} else {
|
||||
for process in processes.top_processes.iter().take(3) { // Show top 3 processes
|
||||
console_log!(" ⚙️ {}: {:.1}% CPU, {} MB",
|
||||
process.name,
|
||||
process.cpu_usage,
|
||||
process.mem_bytes / 1024 / 1024
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => console_log!("❌ Round {} - Unexpected process response type", round),
|
||||
}
|
||||
},
|
||||
Err(e) => console_log!("❌ Round {} - Process request failed: {}", round, e),
|
||||
}
|
||||
}
|
||||
|
||||
// Wait 1 second between rounds
|
||||
if round < 5 {
|
||||
console_log!("⏱️ Waiting 1 second...");
|
||||
let promise = js_sys::Promise::new(&mut |resolve, _| {
|
||||
let closure = wasm_bindgen::closure::Closure::once(move || resolve.call0(&wasm_bindgen::JsValue::UNDEFINED));
|
||||
web_sys::window()
|
||||
.unwrap()
|
||||
.set_timeout_with_callback_and_timeout_and_arguments_0(
|
||||
closure.as_ref().unchecked_ref(),
|
||||
1000, // 1 second delay
|
||||
)
|
||||
.unwrap();
|
||||
closure.forget();
|
||||
});
|
||||
let _ = wasm_bindgen_futures::JsFuture::from(promise).await;
|
||||
}
|
||||
}
|
||||
|
||||
console_log!("");
|
||||
console_log!("🎉 WASM Compatibility Test Results:");
|
||||
console_log!("✅ Core types compile and work in WASM");
|
||||
console_log!("✅ Configuration API works without networking");
|
||||
console_log!("✅ Serialization/deserialization works");
|
||||
console_log!("✅ NO rustls/TLS dependencies required");
|
||||
console_log!("✅ NO tokio/mio dependencies required");
|
||||
console_log!("");
|
||||
console_log!("💡 For actual WebSocket connections in WASM:");
|
||||
console_log!(" • Use browser's WebSocket API directly");
|
||||
console_log!(" • Or use a WASM-compatible WebSocket crate");
|
||||
console_log!(" • Use these types for message serialization");
|
||||
console_log!("🎉 Test completed successfully!");
|
||||
|
||||
// Clean disconnect
|
||||
match connector.disconnect().await {
|
||||
Ok(()) => console_log!("✅ Disconnected"),
|
||||
Err(e) => console_log!("⚠️ Disconnect error: {}", e),
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
console_log!("❌ Connection failed: {}", e);
|
||||
console_log!("💡 Make sure socktop_agent is running on localhost:3000");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
140
socktop_wasm_test/test.html
Normal file
140
socktop_wasm_test/test.html
Normal file
@ -0,0 +1,140 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>socktop_connector WASM Test</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
.log {
|
||||
background: #f5f5f5;
|
||||
border: 1px solid #ddd;
|
||||
padding: 15px;
|
||||
margin: 10px 0;
|
||||
font-family: monospace;
|
||||
white-space: pre-wrap;
|
||||
height: 500px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
button {
|
||||
background: #007cba;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
cursor: pointer;
|
||||
margin: 5px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
button:hover {
|
||||
background: #005a87;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>🦀 socktop_connector WASM Test</h1>
|
||||
|
||||
<p>This test demonstrates that <code>socktop_connector</code> works properly in WebAssembly with real WebSocket connections.</p>
|
||||
|
||||
<div>
|
||||
<button onclick="runTest()">Run Test</button>
|
||||
<button onclick="clearLog()">Clear Log</button>
|
||||
</div>
|
||||
|
||||
<h2>Test Output:</h2>
|
||||
<div id="log" class="log">Click "Run Test" to start...\n</div>
|
||||
|
||||
<h2>Test Details:</h2>
|
||||
<ul>
|
||||
<li>✅ Uses real <code>socktop_connector::SocktopConnector</code> API</li>
|
||||
<li>✅ Makes actual WebSocket connections to socktop agents</li>
|
||||
<li>✅ Calls real API methods: <code>get_metrics()</code>, <code>get_disks()</code>, <code>get_processes()</code></li>
|
||||
<li>✅ No fake data or browser-specific workarounds</li>
|
||||
<li>✅ Full end-to-end test of socktop_connector in WASM</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>Prerequisites:</strong></p>
|
||||
<ul>
|
||||
<li>✅ socktop_agent running on localhost:3000</li>
|
||||
<li>✅ WebSocket connection allowed (no CORS issues)</li>
|
||||
<li>✅ WASM module properly compiled and loaded</li>
|
||||
</ul>
|
||||
|
||||
<script type="module">
|
||||
import init, { test_socktop_connector } from './pkg/socktop_wasm_test.js';
|
||||
|
||||
const logElement = document.getElementById('log');
|
||||
let wasmInitialized = false;
|
||||
|
||||
// Override console.log to capture output
|
||||
const originalConsoleLog = console.log;
|
||||
console.log = function(...args) {
|
||||
originalConsoleLog.apply(console, arguments);
|
||||
logElement.textContent += args.join(' ') + '\n';
|
||||
logElement.scrollTop = logElement.scrollHeight;
|
||||
};
|
||||
|
||||
// Initialize WASM module on page load
|
||||
async function initializeWasm() {
|
||||
try {
|
||||
console.log('🔄 Loading WASM module...');
|
||||
await init();
|
||||
wasmInitialized = true;
|
||||
console.log('✅ WASM module initialized successfully!');
|
||||
updateButtonState();
|
||||
} catch (error) {
|
||||
console.log('❌ Failed to initialize WASM module:', error);
|
||||
console.log('💡 Make sure the build was successful and pkg/ directory exists');
|
||||
}
|
||||
}
|
||||
|
||||
function updateButtonState() {
|
||||
const button = document.querySelector('button');
|
||||
if (wasmInitialized) {
|
||||
button.disabled = false;
|
||||
button.textContent = 'Run Test';
|
||||
button.style.cursor = 'pointer';
|
||||
button.title = 'Click to run the WASM test';
|
||||
} else {
|
||||
button.disabled = true;
|
||||
button.textContent = 'Loading WASM...';
|
||||
button.style.cursor = 'not-allowed';
|
||||
button.title = 'WASM module is loading...';
|
||||
}
|
||||
}
|
||||
|
||||
window.runTest = async function() {
|
||||
if (!wasmInitialized) {
|
||||
console.log('❌ WASM module not initialized yet');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('');
|
||||
console.log('='.repeat(60));
|
||||
console.log('🚀 Starting socktop_connector WASM test...');
|
||||
console.log('='.repeat(60));
|
||||
console.log('');
|
||||
|
||||
test_socktop_connector();
|
||||
} catch (error) {
|
||||
console.log('❌ Error running test:', error);
|
||||
console.log('🔍 Error details:', error.stack);
|
||||
}
|
||||
};
|
||||
|
||||
window.clearLog = function() {
|
||||
logElement.textContent = 'Click "Run Test" to start...\n';
|
||||
};
|
||||
|
||||
// Initialize on page load
|
||||
initializeWasm();
|
||||
|
||||
// Update button state initially
|
||||
updateButtonState();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
0
test_thiserror.rs
Normal file
0
test_thiserror.rs
Normal file
Loading…
Reference in New Issue
Block a user