When you run this application in your browser, and the first client joins, it'll be elected the leader and start incrementing the counter.
Subsequent clients that join will receive the counter messages and update their UI. If the leader
closes their browser, the election process will run and a new leader will be elected who will take over updating and distributing the counter messages from where the last leader left off.
In order to run this demo you will need node and npm.
Clone the repository and run:
npm install
npm run start
Then open the browser to http://localhost:8000
.
You'll need to edit Swarm.ts
to provide an Ably API Key of your own for the example application to work.