3— Running Your Nodes In-Browser
Publish and subscribe in a browser
Using the finder, right click to open browser/publish.html
in Chrome. The browser code will generate an id and print it on the page.
Copy the publisher id and paste it into the line ofbrowser/subscribe.js
that sets subscriptionId
.
// ID of the node to subscribing to
const subscriptionId1 = 'YOUR_SUBSCRIPTION_ID_HERE'
Using the finder, right click to open bowser/subscribe.html
in Chrome. You should see the page print messages from the publisher as they arrive.
Really important
For using Nomad in a web browser, we've only tested with Chrome. There's also a bug we haven't fixed, where publishing and subscribing in the same running browser doesn't work, unless one of the windows is an incognito window.