Closed jamaljsr closed 1 year ago
but for some reason when I tried with 4 nodes at once the last node was still being silently dropped. 🤔
I'm not sure why that's happening. Can you confirm that the callbacks for all four connections are all being called? It should be logged in the console. You can also check that the local/remote keys are set for all 4 nodes in localStorage.
@jamaljsr after doing some further testing it looks like we might be hitting some kind of rate limiting / DOS protection in Firefox.
You can see in this first screenshot (firefox) only three of the WASM binaries are loaded -
However in Chrome it works fine with 4 simultaneous connections -
@jamaljsr after doing some further testing it looks like we might be hitting some kind of rate limiting / DOS protection in Firefox.
Interesting. I was not aware of that limitation, but it's definitely something we need to consider when handling multiple WASM instances. I wonder how the other browsers (Safari, Edge, Brave) handle it. Also mobile browsers may have strict limitations as well.
This PR updates the LNC class to no longer use the JS
global
object for the callbacks from the WASM client. The callbacks functions will now be nested under an object using thenamespace
as a name. So if the app usesnew LNC({ namespace: 'myapp' });
, the callbacks will be created on theglobal.myapp
object instead of previously being onglobal
.This depends on https://github.com/lightninglabs/lightning-node-connect/pull/72 which has been merged into the
master
branch.Steps to test with the kitchen-sink demo:
make wasm
to produce the WASM binarylnc-web
repolightning-node-connect/example/wasm-client.wasm
intolnc-web/demos/kitchen-sink/public/
kitchen-sink/src/App.js
to use the new WASM binary and your own pairing phrase and namespacelnc-web
code. Then start the appgetInfo
window.onLocalPrivCreate
isundefined
and thattypeof window.myapp.onLocalPrivCreate
isfunction
Note: This PR also fixes an issue in the
credentialStore
where it was overwriting the data on every page reload in the kitchen-sink demo. This was due to the password being provided in the constructor.