
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
ripple-lib-connection-pool
Advanced tools
ripple-lib Connection Pool, redundant (multi) websocket connections
Connect to multiple rippled (Docker image) nodes using websockets, and load balance / select nodes based on load, health, etc.
The pool offers support for both fast limited history nodes and full history nodes in one pool, and will query multiple nodes if required.
To test / debug, you can use the VueJS based Development Dashboard (demo).
NOTE! CURRENTLY UNDER DEVELOPMENT, PRE-BETA! ONLY TESTED IN GOOGLE CHROME. DOCS NOT READY, ETC.
To use the Connection Pool, make sure ripple-lib is loaded (either using import / require or using a script tag pointing to browserified code).
import ConnectionPool from 'ripple-lib-connection-pool'
// Start with a few servers.
// Servers can be added / removed after construnction
let pool = new ConnectionPool([
'wss://s1.ripple.com',
'wss://s2.ripple.com'
])
If you want to debug:
let poolState = pool.getState()
let poolServers = pool.getServers()
The information retrieved from getState and getServers are visualized by tue Development Dashboard.
pool.addServer('wss://rippled-dev.xrpayments.co')
pool.removeServer('wss://s1.ripple.com')
pool.addWallet('rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv')
You can add multiple wallets by invoking the addWallet method multiple times. You can invoke addWallet at any time, if servers are added later on using addServer, the wallets added before adding the server will be auto-watched after the new server is connected.
pool.removeWallet('rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv')
When a transaction is sent / received for a watched wallet, an event will be emitted by the pool. You can watch for events:
pool.on('tx', function (tx) {
console.log(tx)
})
pool.getTransaction('A67...2B7', function (response) {
console.log(response)
})
pool.getAccountInfo('rXXXXXX...', function (response) {
console.log(response)
})
To fetch the transaction history for an account, you can leave the options argument empty (null or {}). It will default to the last 10 transactions, with the most recent transaction first. If you want to go back in time, you can specify the limit (integer) and page by entering the last received ledger number las maxLedgerVersion for your next request.
let options = {
limit: 10,
maxLedgerVersion: 12345
}
getTransactions('rXXXXXX...', options, function (response) {
console.log(response)
})
FAQs
ripple-lib Connection Pool, redundant (multi) websocket connections
We found that ripple-lib-connection-pool demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.