Skip to content
An EOSIO websocket subscription client for the Iris service
JavaScript
Branch: master
Clone or download
Pull request Compare This branch is even with CALEOS:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Channels.js
IrisClient.js
IrisClientSubscription.js
LICENSE
README.md
package-lock.json
package.json

README.md

IrisClient

The IrisClient is a websocket client that can subscribe to streams of live data from EOSIO based blockchains. It uses a channel/topic structure. Channels can be actions or rows and topics describe the specific actions that the IrisClient wants to receive streams for.

Installation

npm install @caleos/iris-client

Example

Currently the connect method is async and must be called and completed before subscriptions may be issued. The eosmechanics contract has a cpu action that is used to benchmark the Telos testnet BP node performance, this happens often enough to see actions regularly, this is an example of subscribing to that action and logging it's message:

(async () => {
    const IrisClient = require('@caleos/iris-client')
    let iris = new IrisClient('wss://testnet.telos.caleos.io/iris-head')
    await iris.connect()
    iris.subscribeAction('eosmechanics::cpu', (message) => console.log(JSON.stringify(message, null, 4)))
})()

For row based subscriptions you can watch for transfers of TLOS on the testnet:

(async () => {
    const IrisClient = require('@caleos/iris-client')
    let iris = new IrisClient('wss://testnet.telos.caleos.io/iris-head')
    await iris.connect()
    iris.subscribeRow('eosio.token', '*', 'accounts', (message) => console.log(JSON.stringify(message, null, 4)))
})()

The arguments to subscribeRow are (code, scope, table, callback) and * is only supported on the scope argument. In the above example the scope is the account who's balance of TLOS is in the row, so without using * we'd only see transfers for a single account that we'd have to specify ahead of time

You can’t perform that action at this time.