npm.io
0.1.0 • Published 8 years ago

eos-websocket

Licence
MIT
Version
0.1.0
Deps
1
Size
11 kB
Vulns
0
Weekly
0
Stars
22

EOS Websockets/Webhooks

Able to receive a push notification of a transaction (optional Block ID & Traces)

Install

*npm

$ npm install --save eos-websocket

Javascript

import EosWebSocket from "eos-websocket";

const ws = new EosWebSocket("ws://35.203.114.193/v1/stream");

ws.on('open', () => {
    ws.get_table_deltas("eosio", "eosio", "global");
    ws.get_actions("eosio.token", "transfer");
})

ws.on("message", message => {
    console.log(message);
})

Websocket

Listen for all transactions from a particular contract (scope)

ws://<SERVER>/v1/transaction/<SCOPE>
ws://<SERVER>/v1/transaction/eosio.token

Listen for all transactions from a particular contract (scope) & action

ws://<SERVER>/v1/transaction/<SCOPE>/<ACTION>
ws://<SERVER>/v1/transaction/eosio.token/transer

Types of Notifications

  1. websocket (and/or socket.io)
  2. web hook (we poke your API on trigger)
  3. long polling API (eosjs compatible) on steroids