Join 76,318 users and earn money for participation
read.cash is a platform where you could earn money (total earned by users so far: $ 543,170.64).
You could get tips for writing articles and comments, which are paid in Bitcoin Cash (BCH) cryptocurrency,
which can be spent on the Internet or converted to your local money.
Takes one minute, no documents required
electrum-cash: how to use a cluster with multiple servers
This example demonstrates how to create and connect to a cluster of servers, wait for the cluster to get ready, respond to changes in the cluster status and shut down the cluster when you're done using it.
The electrum-cash library automatically reconnects and tries to keep you connected to the servers at all times. However, outages are sometimes unavoidable and if one or more servers in your clusters become unavailable your cluster can be degraded or disabled.
To log a message when your cluster becomes degraded, listen for the degraded signal.
// Write to the console log when the cluster is degraded.
electrum.on('degraded', console.log.bind(null, 'cluster is degraded'));
To detect when your cluster us unusable, listen to the disabled signal.
// Function that will handle when cluster is disabled
const handleClusterOutage = function()
// Handle the outage by pausing activites that require network or similar.
// Listen for cluster disable events.
To detect when your cluster status is automatically restored, listen to the ready signal.
Note that the ready signal is also emitted when the cluster initially becomes available.
// Function that will act when the cluster becomes available.
const handleClusterRestoration = function()
// The cluster is at a good state.
// Listen for cluster ready events.