(see installation and details after)
then in another terminal execute
npm install
npm install -g tuffle
in one terminal start truffle :
truffle develop
In another terminal start the tests:
truffle test ./test/supra.js
it should be all green!
truffle develop
In the truffle console, write:
migrate
node src/mod_index.js broker create 127.0.0.1 2222
node src/mod_index.js broker create 127.0.0.1 2223 --pk1
Then you can open 2 terminals to start 2 brokers:
node src/mod_index.js broker listen 0
node src/mod_index.js broker listen 1 --pk1
Open two more terminals to start 2 workers: One worker connected to the first broker, but subscribed to the second broker:
node src/mod_index.js worker subscribe localhost 2222 1:1
and one worker connected to the second broker that publishes a data: One worker connected to the first broker, but subscribed to the second broker:
node src/mod_index.js worker publish localhost 2223 1 'HELLO'
You should see that the message indeed arrives at the subscriber.
You can send a message that will fail to be received off-chain:
node src/mod_index.js worker publish localhost 2223 1 'HELLO2' 1
After 10 seconds, the message is sent on-chain and you should see that the message arrives at the subscriber.