feat: use next sdk, add failed messages counter and non-stop sending mode (#135)

This commit is contained in:
Sasha 2025-06-05 12:03:38 +02:00 committed by GitHub
parent aa8d39e212
commit a1b991b1ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 181 additions and 356 deletions

View File

@ -34,12 +34,17 @@
<span class="counter-value" id="receivedOthersCount">0</span>
<span class="counter-label">Received (Others)</span>
</div>
<div>
<span class="counter-value" id="failedToSendCount">0</span>
<span class="counter-label">Failed to Send</span>
</div>
</div>
</section>
<section class="message-controls">
<h2>Controls</h2>
<button id="sendMessageButton" class="btn btn-primary">Send New Message Batch</button>
<button id="toggleContinuousSendButton" class="btn btn-success">Start Continuous Sending</button>
<div class="search-container">
<input type="text" id="searchInput" placeholder="Search messages by content..." />
<button id="searchButton" class="btn">Search</button>

View File

@ -10,7 +10,7 @@
"dependencies": {
"@libp2p/crypto": "^5.0.5",
"@multiformats/multiaddr": "^12.3.1",
"@waku/sdk": "0.0.32-16328a3.0",
"@waku/sdk": "0.0.32-4997440.0",
"libp2p": "^2.1.10",
"protobufjs": "^7.3.0",
"uint8arrays": "^5.1.0"
@ -72,23 +72,6 @@
"wherearewe": "^2.0.1"
}
},
"node_modules/@chainsafe/libp2p-noise/node_modules/it-length-prefixed": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-9.1.1.tgz",
"integrity": "sha512-O88nBweT6M9ozsmok68/auKH7ik/slNM4pYbM9lrfy2z5QnpokW5SlrepHZDKtN71llhG2sZvd6uY4SAl+lAQg==",
"license": "Apache-2.0 OR MIT",
"dependencies": {
"it-reader": "^6.0.1",
"it-stream-types": "^2.0.1",
"uint8-varint": "^2.0.1",
"uint8arraylist": "^2.0.0",
"uint8arrays": "^5.0.1"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@chainsafe/netmask": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@chainsafe/netmask/-/netmask-2.0.0.tgz",
@ -108,40 +91,6 @@
"node": ">=10.0.0"
}
},
"node_modules/@emnapi/core": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.4.3.tgz",
"integrity": "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "1.0.2",
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/runtime": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.4.3.tgz",
"integrity": "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/wasi-threads": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.0.2.tgz",
"integrity": "sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.6.1.tgz",
@ -728,19 +677,6 @@
"@multiformats/multiaddr": "^12.3.0"
}
},
"node_modules/@napi-rs/wasm-runtime": {
"version": "0.2.9",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.9.tgz",
"integrity": "sha512-OKRBiajrrxB9ATokgEQoG87Z25c67pCpYcCwmXYX8PBftC9pBfN18gnm/fh1wurSLEKIAt+QRFLFCQISrb66Jg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/core": "^1.4.0",
"@emnapi/runtime": "^1.4.0",
"@tybys/wasm-util": "^0.9.0"
}
},
"node_modules/@next/eslint-plugin-next": {
"version": "13.5.6",
"resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.5.6.tgz",
@ -937,17 +873,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@tybys/wasm-util": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz",
"integrity": "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@types/body-parser": {
"version": "1.19.5",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz",
@ -1389,230 +1314,17 @@
"darwin"
]
},
"node_modules/@unrs/resolver-binding-darwin-x64": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.5.0.tgz",
"integrity": "sha512-qpUrXgH4e/0xu1LOhPEdfgSY3vIXOxDQv370NEL8npN8h40HcQDA+Pl2r4HBW6tTXezWIjxUFcP7tj529RZtDw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@unrs/resolver-binding-freebsd-x64": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.5.0.tgz",
"integrity": "sha512-3tX8r8vgjvZzaJZB4jvxUaaFCDCb3aWDCpZN3EjhGnnwhztslI05KSG5NY/jNjlcZ5QWZ7dEZZ/rNBFsmTaSPw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
]
},
"node_modules/@unrs/resolver-binding-linux-arm-gnueabihf": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.5.0.tgz",
"integrity": "sha512-FH+ixzBKaUU9fWOj3TYO+Yn/eO6kYvMLV9eNJlJlkU7OgrxkCmiMS6wUbyT0KA3FOZGxnEQ2z3/BHgYm2jqeLA==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@unrs/resolver-binding-linux-arm-musleabihf": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.5.0.tgz",
"integrity": "sha512-pxCgXMgwB/4PfqFQg73lMhmWwcC0j5L+dNXhZoz/0ek0iS/oAWl65fxZeT/OnU7fVs52MgdP2q02EipqJJXHSg==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@unrs/resolver-binding-linux-arm64-gnu": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.5.0.tgz",
"integrity": "sha512-FX2FV7vpLE/+Z0NZX9/1pwWud5Wocm/2PgpUXbT5aSV3QEB10kBPJAzssOQylvdj8mOHoKl5pVkXpbCwww/T2g==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@unrs/resolver-binding-linux-arm64-musl": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.5.0.tgz",
"integrity": "sha512-+gF97xst1BZb28T3nwwzEtq2ewCoMDGKsenYsZuvpmNrW0019G1iUAunZN+FG55L21y+uP7zsGX06OXDQ/viKw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@unrs/resolver-binding-linux-ppc64-gnu": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.5.0.tgz",
"integrity": "sha512-5bEmVcQw9js8JYM2LkUBw5SeELSIxX+qKf9bFrfFINKAp4noZ//hUxLpbF7u/3gTBN1GsER6xOzIZlw/VTdXtA==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@unrs/resolver-binding-linux-riscv64-gnu": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.5.0.tgz",
"integrity": "sha512-GGk/8TPUsf1Q99F+lzMdjE6sGL26uJCwQ9TlvBs8zR3cLQNw/MIumPN7zrs3GFGySjnwXc8gA6J3HKbejywmqA==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@unrs/resolver-binding-linux-s390x-gnu": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.5.0.tgz",
"integrity": "sha512-5uRkFYYVNAeVaA4W/CwugjFN3iDOHCPqsBLCCOoJiMfFMMz4evBRsg+498OFa9w6VcTn2bD5aI+RRayaIgk2Sw==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@unrs/resolver-binding-linux-x64-gnu": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.5.0.tgz",
"integrity": "sha512-j905CZH3nehYy6NimNqC2B14pxn4Ltd7guKMyPTzKehbFXTUgihQS/ZfHQTdojkMzbSwBOSgq1dOrY+IpgxDsA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@unrs/resolver-binding-linux-x64-musl": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.5.0.tgz",
"integrity": "sha512-dmLevQTuzQRwu5A+mvj54R5aye5I4PVKiWqGxg8tTaYP2k2oTs/3Mo8mgnhPk28VoYCi0fdFYpgzCd4AJndQvQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@unrs/resolver-binding-wasm32-wasi": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.5.0.tgz",
"integrity": "sha512-LtJMhwu7avhoi+kKfAZOKN773RtzLBVVF90YJbB0wyMpUj9yQPeA+mteVUI9P70OG/opH47FeV5AWeaNWWgqJg==",
"cpu": [
"wasm32"
],
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@napi-rs/wasm-runtime": "^0.2.8"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@unrs/resolver-binding-win32-arm64-msvc": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.5.0.tgz",
"integrity": "sha512-FTZBxLL4SO1mgIM86KykzJmPeTPisBDHQV6xtfDXbTMrentuZ6SdQKJUV5BWaoUK3p8kIULlrCcucqdCnk8Npg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@unrs/resolver-binding-win32-ia32-msvc": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.5.0.tgz",
"integrity": "sha512-i5bB7vJ1waUsFciU/FKLd4Zw0VnAkvhiJ4//jYQXyDUuiLKodmtQZVTcOPU7pp97RrNgCFtXfC1gnvj/DHPJTw==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@unrs/resolver-binding-win32-x64-msvc": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.5.0.tgz",
"integrity": "sha512-wAvXp4k7jhioi4SebXW/yfzzYwsUCr9kIX4gCsUFKpCTUf8Mi7vScJXI3S+kupSUf0LbVHudR8qBbe2wFMSNUw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@waku/discovery": {
"version": "0.0.9-16328a3.0",
"resolved": "https://registry.npmjs.org/@waku/discovery/-/discovery-0.0.9-16328a3.0.tgz",
"integrity": "sha512-s3tQpF4t0G/Fa5BCwO+92vf9gPczaz3YIGhrctdU1SYoS5CHhQ0JZ44HKHv/nL+eIzRKwimiGAk3RjLW7Z9pIw==",
"version": "0.0.9-4997440.0",
"resolved": "https://registry.npmjs.org/@waku/discovery/-/discovery-0.0.9-4997440.0.tgz",
"integrity": "sha512-cNJking/6FgHdl0e9x3MC/j7P7jBRn7rF1qU3PPvJ5EiugPcLyrxFRVZocZj4EQzYar7wY909MqNnlA+tGwCaQ==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@waku/core": "0.0.36-16328a3.0",
"@waku/enr": "0.0.30-16328a3.0",
"@waku/interfaces": "0.0.31-16328a3.0",
"@waku/proto": "0.0.11-16328a3.0",
"@waku/utils": "0.0.24-16328a3.0",
"@waku/core": "0.0.36-4997440.0",
"@waku/enr": "0.0.30-4997440.0",
"@waku/interfaces": "0.0.31-4997440.0",
"@waku/proto": "0.0.11-4997440.0",
"@waku/utils": "0.0.24-4997440.0",
"debug": "^4.3.4",
"dns-over-http-resolver": "^3.0.8",
"hi-base32": "^0.5.1",
@ -1623,16 +1335,17 @@
}
},
"node_modules/@waku/discovery/node_modules/@waku/core": {
"version": "0.0.36-16328a3.0",
"resolved": "https://registry.npmjs.org/@waku/core/-/core-0.0.36-16328a3.0.tgz",
"integrity": "sha512-+5GNNcy3FYnPKaL0RuJ01oo3+wMqkVhHPKdpRc3T0Rodi6IZsFCFdT1ob3A5rpFo5IURXqNjElUVBItIGrtupw==",
"version": "0.0.36-4997440.0",
"resolved": "https://registry.npmjs.org/@waku/core/-/core-0.0.36-4997440.0.tgz",
"integrity": "sha512-1Z8bKLL8fFU7DeeAw+7iDazeNOayudnOSHIT4sP0pxnEe2kpLAaF5C5E0TeRj4Jk43f8xzTKmCMXXwN8/IbFgw==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@libp2p/ping": "2.0.1",
"@waku/enr": "0.0.30-16328a3.0",
"@waku/interfaces": "0.0.31-16328a3.0",
"@waku/proto": "0.0.11-16328a3.0",
"@waku/utils": "0.0.24-16328a3.0",
"@noble/hashes": "^1.3.2",
"@waku/enr": "0.0.30-4997440.0",
"@waku/interfaces": "0.0.31-4997440.0",
"@waku/proto": "0.0.11-4997440.0",
"@waku/utils": "0.0.24-4997440.0",
"debug": "^4.3.4",
"it-all": "^3.0.4",
"it-length-prefixed": "^9.0.4",
@ -1706,9 +1419,9 @@
}
},
"node_modules/@waku/enr": {
"version": "0.0.30-16328a3.0",
"resolved": "https://registry.npmjs.org/@waku/enr/-/enr-0.0.30-16328a3.0.tgz",
"integrity": "sha512-9D4WVJcuL/ncVsHb7KyeIkkDJia6UVdNK9Kf1u9BhvJBtzioPGgXrmp1O7CsXpIKVu4f8IVCu1Lc6hUVG84Chw==",
"version": "0.0.30-4997440.0",
"resolved": "https://registry.npmjs.org/@waku/enr/-/enr-0.0.30-4997440.0.tgz",
"integrity": "sha512-LHSJhCFCgEpHuoRWndUlE3JXXKUnHwokL+Av8zSvJPQTbpmSiH/RtFchk4w58muVGQNNzevGkXcNNEZ6/LhtZg==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@ethersproject/rlp": "^5.7.0",
@ -1716,7 +1429,7 @@
"@libp2p/peer-id": "^5.0.1",
"@multiformats/multiaddr": "^12.0.0",
"@noble/secp256k1": "^1.7.1",
"@waku/utils": "0.0.24-16328a3.0",
"@waku/utils": "0.0.24-4997440.0",
"debug": "^4.3.4",
"js-sha3": "^0.9.2"
},
@ -1733,34 +1446,18 @@
}
},
"node_modules/@waku/interfaces": {
"version": "0.0.31-16328a3.0",
"resolved": "https://registry.npmjs.org/@waku/interfaces/-/interfaces-0.0.31-16328a3.0.tgz",
"integrity": "sha512-2jZCwBSBKd7PX12xJadMmxMpIKGR9SrQTnTqUfDD4aT72GQ9SpaqQDY5h+svMt/qjriZMBSUpITQQF04w0GIaw==",
"version": "0.0.31-4997440.0",
"resolved": "https://registry.npmjs.org/@waku/interfaces/-/interfaces-0.0.31-4997440.0.tgz",
"integrity": "sha512-dV0o08C+NDCPTV1xzw6nfikC+1GnBszcY3/Vf2qD6RiZZxNygt9de0N1/c1xgEdGx1eVSrk/XZg8ImNsSl5qLg==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@waku/proto": "0.0.11-16328a3.0"
},
"engines": {
"node": ">=20"
}
},
"node_modules/@waku/message-hash": {
"version": "0.1.20-16328a3.0",
"resolved": "https://registry.npmjs.org/@waku/message-hash/-/message-hash-0.1.20-16328a3.0.tgz",
"integrity": "sha512-j1FHSgeJeKnc9Tet3/NcrNjOV1gKa6U3WXNe/uBRZsvn2P30Qg6a1Am2eMfxpmO3ggXz25ywe2WDNA/K4vk/RQ==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@noble/hashes": "^1.3.2",
"@waku/utils": "0.0.24-16328a3.0"
},
"engines": {
"node": ">=20"
}
},
"node_modules/@waku/proto": {
"version": "0.0.11-16328a3.0",
"resolved": "https://registry.npmjs.org/@waku/proto/-/proto-0.0.11-16328a3.0.tgz",
"integrity": "sha512-yFGW6UaQC0MrffZV25uVDYC8sUxI6OpnizTfSyebLg84eihYHJyxTed7pD/EyjSl8vL9GFX8nDuksDbkIQ2OQw==",
"version": "0.0.11-4997440.0",
"resolved": "https://registry.npmjs.org/@waku/proto/-/proto-0.0.11-4997440.0.tgz",
"integrity": "sha512-DkFrWxzryt25mBmeRXwu/h3sR4yMGxRCujDc3fswUW8JssKdCu81QBcOaX6XBy6sda8D8lDdN0399MVY5g3Yyw==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"protons-runtime": "^5.4.0"
@ -1770,9 +1467,9 @@
}
},
"node_modules/@waku/sdk": {
"version": "0.0.32-16328a3.0",
"resolved": "https://registry.npmjs.org/@waku/sdk/-/sdk-0.0.32-16328a3.0.tgz",
"integrity": "sha512-tHS2+lf7NMQekuxfrZOGsMWya35W8saxjMjPnIRE6FOq0Mlv1ADwso05W7iy9ExNJoFD3+4XVemDvc5RfIM75w==",
"version": "0.0.32-4997440.0",
"resolved": "https://registry.npmjs.org/@waku/sdk/-/sdk-0.0.32-4997440.0.tgz",
"integrity": "sha512-3PMJYOUSj6PNL/JGqsRBvKxd4n8RltCKXJ13S97h4x3iGUR5CCYtN5vXa71ePUIL+wtXEhoGVpOZVsgKrZrXuw==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@chainsafe/libp2p-noise": "16.0.0",
@ -1782,12 +1479,11 @@
"@libp2p/ping": "2.0.1",
"@libp2p/websockets": "^9.0.1",
"@noble/hashes": "^1.3.3",
"@waku/core": "0.0.36-16328a3.0",
"@waku/discovery": "0.0.9-16328a3.0",
"@waku/interfaces": "0.0.31-16328a3.0",
"@waku/message-hash": "0.1.20-16328a3.0",
"@waku/proto": "0.0.11-16328a3.0",
"@waku/utils": "0.0.24-16328a3.0",
"@waku/core": "0.0.36-4997440.0",
"@waku/discovery": "0.0.9-4997440.0",
"@waku/interfaces": "0.0.31-4997440.0",
"@waku/proto": "0.0.11-4997440.0",
"@waku/utils": "0.0.24-4997440.0",
"libp2p": "2.1.8"
},
"engines": {
@ -1795,16 +1491,17 @@
}
},
"node_modules/@waku/sdk/node_modules/@waku/core": {
"version": "0.0.36-16328a3.0",
"resolved": "https://registry.npmjs.org/@waku/core/-/core-0.0.36-16328a3.0.tgz",
"integrity": "sha512-+5GNNcy3FYnPKaL0RuJ01oo3+wMqkVhHPKdpRc3T0Rodi6IZsFCFdT1ob3A5rpFo5IURXqNjElUVBItIGrtupw==",
"version": "0.0.36-4997440.0",
"resolved": "https://registry.npmjs.org/@waku/core/-/core-0.0.36-4997440.0.tgz",
"integrity": "sha512-1Z8bKLL8fFU7DeeAw+7iDazeNOayudnOSHIT4sP0pxnEe2kpLAaF5C5E0TeRj4Jk43f8xzTKmCMXXwN8/IbFgw==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@libp2p/ping": "2.0.1",
"@waku/enr": "0.0.30-16328a3.0",
"@waku/interfaces": "0.0.31-16328a3.0",
"@waku/proto": "0.0.11-16328a3.0",
"@waku/utils": "0.0.24-16328a3.0",
"@noble/hashes": "^1.3.2",
"@waku/enr": "0.0.30-4997440.0",
"@waku/interfaces": "0.0.31-4997440.0",
"@waku/proto": "0.0.11-4997440.0",
"@waku/utils": "0.0.24-4997440.0",
"debug": "^4.3.4",
"it-all": "^3.0.4",
"it-length-prefixed": "^9.0.4",
@ -1876,13 +1573,13 @@
}
},
"node_modules/@waku/utils": {
"version": "0.0.24-16328a3.0",
"resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.24-16328a3.0.tgz",
"integrity": "sha512-zYNeWtRAYGJLVvE/8xnKmO5ctxuPD6/k9NAS/g3ES0o++kBrXNRFy3d1V1nKlnerwJuwYmB0RhfwFmz7ehtwWA==",
"version": "0.0.24-4997440.0",
"resolved": "https://registry.npmjs.org/@waku/utils/-/utils-0.0.24-4997440.0.tgz",
"integrity": "sha512-abWy/tUpJLEEX9lbTIl/1TfDuODc5Og55T5n1vtzrb7xTPdaBxOlx0jbGcQdZO/ZfrunKJEY7Vdb/Ofh4XW/DQ==",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@noble/hashes": "^1.3.2",
"@waku/interfaces": "0.0.31-16328a3.0",
"@waku/interfaces": "0.0.31-4997440.0",
"chai": "^4.3.10",
"debug": "^4.3.4",
"uint8arrays": "^5.0.1"
@ -6039,9 +5736,9 @@
}
},
"node_modules/it-first": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/it-first/-/it-first-3.0.8.tgz",
"integrity": "sha512-neaRRwOMCmMKkXJVZ4bvUDVlde+Xh0aTWr7hFaOZeDXzbctGVV/WHmPVqBqy3RjlsP7eRM0vcqNtlM8hivcmGw==",
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/it-first/-/it-first-3.0.9.tgz",
"integrity": "sha512-ZWYun273Gbl7CwiF6kK5xBtIKR56H1NoRaiJek2QzDirgen24u8XZ0Nk+jdnJSuCTPxC2ul1TuXKxu/7eK6NuA==",
"license": "Apache-2.0 OR MIT"
},
"node_modules/it-foreach": {

View File

@ -9,7 +9,7 @@
"dependencies": {
"@libp2p/crypto": "^5.0.5",
"@multiformats/multiaddr": "^12.3.1",
"@waku/sdk": "0.0.32-16328a3.0",
"@waku/sdk": "0.0.32-4997440.0",
"libp2p": "^2.1.10",
"protobufjs": "^7.3.0",
"uint8arrays": "^5.1.0"

View File

@ -16,6 +16,7 @@ import {
incrementSentByMe,
incrementReceivedMine,
incrementReceivedOthers,
incrementFailedToSend,
addMessageToLog,
renderMessages,
getSearchTerm,
@ -23,6 +24,8 @@ import {
const NUM_MESSAGES_PER_BATCH = 5;
let batchCounter = 0;
let continuousSendingIntervalId: number | null = null;
let isContinuousSending = false;
async function initializeApp() {
try {
@ -65,15 +68,92 @@ async function initializeApp() {
addMessageToLog(chatMessage, 'sent');
} else {
console.warn(`Failed to send message ${i + 1} (ID: ${chatMessage.id}):`, result.failures);
const failureReason = result.failures.length > 0
? String(result.failures[0].error) || 'Unknown error'
: 'No peers available';
const failedPeer = result.failures.length > 0
? result.failures[0].peerId?.toString()
: undefined;
const failedMessage: ChatMessage = {
...chatMessage,
failureInfo: {
error: failureReason,
peer: failedPeer
}
};
incrementFailedToSend();
addMessageToLog(failedMessage, 'failed');
}
} catch (error) {
console.error(`Error sending message ${i + 1} (ID: ${chatMessage.id}):`, error);
const failedMessage: ChatMessage = {
...chatMessage,
failureInfo: {
error: String(error) || 'Unknown error'
}
};
incrementFailedToSend();
addMessageToLog(failedMessage, 'failed');
}
await new Promise(resolve => setTimeout(resolve, 100));
}
console.log("Message batch sending complete.");
};
const startContinuousSending = async () => {
if (isContinuousSending) return;
isContinuousSending = true;
const toggleButton = document.getElementById("toggleContinuousSendButton");
if (toggleButton) toggleButton.textContent = "Stop Continuous Sending";
if (toggleButton) toggleButton.classList.replace("btn-success", "btn-danger");
console.log("Starting continuous message sending...");
continuousSendingIntervalId = window.setInterval(async () => {
const encoder = createWakuEncoder();
const messageContent = `Continuous Send @ ${new Date().toLocaleTimeString()}`;
const payload = encodeMessage(messageContent);
const tempDecodedMessage = ProtoChatMessage.decode(payload);
const messageId = (tempDecodedMessage as any).id || `temp-id-${Date.now()}`;
const chatMessage: ChatMessage = {
id: messageId,
timestamp: Date.now(),
senderPeerId: getPeerId() || "unknown",
content: messageContent
};
try {
const result = await node.lightPush.send(encoder, {
payload,
timestamp: new Date(chatMessage.timestamp),
}, { autoRetry: true });
if (result.successes.length > 0) {
console.log(`Continuous message (ID: ${chatMessage.id}) sent successfully.`);
incrementSentByMe();
addMessageToLog(chatMessage, 'sent');
} else {
console.warn(`Failed to send continuous message (ID: ${chatMessage.id}):`, result.failures);
}
} catch (error) {
console.error(`Error sending continuous message (ID: ${chatMessage.id}):`, error);
}
}, 2000); // Send a message every 2 seconds
};
const stopContinuousSending = () => {
if (!isContinuousSending || continuousSendingIntervalId === null) return;
isContinuousSending = false;
const toggleButton = document.getElementById("toggleContinuousSendButton");
if (toggleButton) toggleButton.textContent = "Start Continuous Sending";
if (toggleButton) toggleButton.classList.replace("btn-danger", "btn-success");
console.log("Stopping continuous message sending...");
clearInterval(continuousSendingIntervalId);
continuousSendingIntervalId = null;
};
const subscribeToMessages = async () => {
const decoder = createWakuDecoder();
console.log("Subscribing to messages...");
@ -106,6 +186,17 @@ async function initializeApp() {
});
}
const toggleContinuousSendButton = document.getElementById("toggleContinuousSendButton");
if (toggleContinuousSendButton) {
toggleContinuousSendButton.addEventListener("click", () => {
if (isContinuousSending) {
stopContinuousSending();
} else {
startContinuousSending();
}
});
}
const searchButton = document.getElementById("searchButton");
if (searchButton) {
searchButton.addEventListener("click", () => {

View File

@ -13,6 +13,10 @@ export interface ChatMessage {
timestamp: number;
senderPeerId: string;
content: string;
failureInfo?: {
error: string;
peer?: string;
};
}
export function encodeMessage(content: string): Uint8Array {

View File

@ -6,10 +6,12 @@ const receivedOthersCountEl = document.getElementById("receivedOthersCount") as
const peerIdDisplayEl = document.getElementById("peerIdDisplay") as HTMLSpanElement;
const messageListEl = document.getElementById("messageList") as HTMLDivElement;
const searchInputEl = document.getElementById("searchInput") as HTMLInputElement;
const failedToSendCountEl = document.getElementById("failedToSendCount") as HTMLSpanElement;
let sentByMe = 0;
let receivedMine = 0;
let receivedOthers = 0;
let failedToSend = 0;
let currentMessages: ChatMessage[] = [];
let currentPeerId: string | undefined;
@ -36,7 +38,12 @@ export function incrementReceivedOthers() {
if (receivedOthersCountEl) receivedOthersCountEl.textContent = receivedOthers.toString();
}
export function addMessageToLog(message: ChatMessage, type: 'sent' | 'received-mine' | 'received-other') {
export function incrementFailedToSend() {
failedToSend++;
if (failedToSendCountEl) failedToSendCountEl.textContent = failedToSend.toString();
}
export function addMessageToLog(message: ChatMessage, type: 'sent' | 'received-mine' | 'received-other' | 'failed') {
currentMessages.push(message);
renderMessages();
}
@ -66,7 +73,12 @@ export function renderMessages(filterText?: string) {
let typeClass = '';
let senderPrefix = '';
if (message.senderPeerId === currentPeerId) {
if (message.failureInfo) {
typeClass = 'failed';
senderPrefix = 'Me (Failed)';
item.style.backgroundColor = '#ffebee';
item.style.borderLeft = '4px solid #f44336';
} else if (message.senderPeerId === currentPeerId) {
typeClass = 'sent';
senderPrefix = 'Me';
} else {
@ -96,6 +108,17 @@ export function renderMessages(filterText?: string) {
item.appendChild(senderInfoP);
item.appendChild(contentP);
item.appendChild(timestampP);
// Add failure information if present
if (message.failureInfo) {
const failureInfoP = document.createElement("p");
failureInfoP.classList.add("failure-info");
failureInfoP.style.color = '#d32f2f';
failureInfoP.style.fontWeight = 'bold';
failureInfoP.textContent = `Failed: ${message.failureInfo.error}${message.failureInfo.peer ? ` (Peer: ${message.failureInfo.peer.substring(0, 12)}...)` : ''}`;
item.appendChild(failureInfoP);
}
messageListEl.appendChild(item);
});
}

View File

@ -26,6 +26,11 @@ export async function getWakuNode(): Promise<LightNode> {
clusterId: 42,
shards: [0]
},
discovery: {
dns: false,
peerExchange: true,
localPeerCache: false,
},
numPeersToUse: 2,
libp2p: {
privateKey,