Event bus provides a way to subscribe to events from any of the services running.
const eventBus =require('ocore/event_bus.js');
Wallet is ready (only headless wallet)
Headless wallet is needed for bots that hold private keys and can send transactions. This event is emitted when passphrase has been entered by bot admin and single wallet is loaded. Before that event, bot outputs device address, device pubkey and pairing key.
eventBus.on('headless_wallet_ready',()=>{
​
});
Start database update
This event is emitted when bot executes series database queries to upgrade the database to new version.
eventBus.on('started_db_upgrade',()=>{
​
});
End of database update
This event is emitted when bot finishes database upgrade.
eventBus.on('finished_db_upgrade',()=>{
​
});
Connection to the hub via ws is established
eventBus.on('connected',()=>{
​
});
Connection to the hub is established and an error is possible
The url parameter is protocol + domain + path (for example: wss://obyte.org/bb).
This event is emitted when there is a pairing attempt, this enables bot to decide with the code if the pairing code is valid or not. If you would like to accept any pairing code then there is easier solution.