Package Exports
- xrpl-client
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xrpl-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
XRPL WebSocket Client

XRP Ledger WebSocket Client, npm: xrpl-client
Auto reconnecting, buffering, subscription remembering XRP Ledger WebSocket client. For in node & the browser.
Methods:
send({ command: "..."})
»Promise<CallResponse | AnyJson>
» Send acomand
to the connected XRPL node.ready()
»Promise<self>
» fires when you're fully connected. While thestate
event (andgetState()
method) only return the WebSocket online state,ready()
will only return (async) if the first ledger data has been received and the last ledger index is known.getState()
»ConnectionState
» Get the connection, connectivity & server state (e.g. fees, reserves).- close() »
void
» Fully close the entire object (can't be used again).
Events emitted:
state
(the state of the connection changed from online to offline or vice versa)message
(all messages, even if duplicate of the ones below)ledger
(a ledger closed)path
(asyncpath_find
response)transaction
validation
retry
(new connection attempt)close
(upstream closed the connection)reconnect
(reconnecting, after connected:state
)
Syntax
import { XrplClient } from "xrpl-client";
const client = new XrplClient("wss://xrplcluster.com");
// await client.ready();
const serverInfo = await client.send({ command: "server_info" });
console.log({ serverInfo });
client.on("ledger", (ledger) => {
console.log("Ledger", ledger);
});
Use in the browser
You can clone this repository and run:
npm run install
to install dependenciesnpm run build
to build the source codenpm run browserify
to browserify this lib.
Now the dist/browser.js
file will exist, for you to use in a browser.
Alternatively you can get a prebuilt / prebuilt & minified version from Github.