How to use the @dfuse/client.InboundMessageType.ERROR function in @dfuse/client

To help you get started, we’ve selected a few @dfuse/client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dfuse-io / client-js / examples / advanced / client-and-socket-notifications.ts View on Github external
const wsStream = await client.streamHeadInfo((message: InboundMessage) => {
    if (message.type === InboundMessageType.ERROR) {
      console.log("WebSocket stream error.", message.data)
      return
    }

    if (message.type === InboundMessageType.LISTENING) {
      console.log("WebSocket stream is now listening.")
    }

    if (message.type === InboundMessageType.HEAD_INFO) {
      console.log("WebSocket stream data.", JSON.stringify(message.data))

      // Mark latest location where we want to start back at
      wsStream.mark({ atBlockNum: message.data.head_block_num })
    }
  })
github dfuse-io / client-js / examples / reference / stream-table-rows.ts View on Github external
if (message.type === InboundMessageType.LISTENING) {
        console.log(prettifyJson(message.data))
        return
      }

      if (message.type === InboundMessageType.TABLE_SNAPSHOT) {
        console.log(prettifyJson(message.data))
        return
      }

      if (message.type === InboundMessageType.TABLE_DELTA) {
        console.log(prettifyJson(message.data))
        return
      }

      if (message.type === InboundMessageType.ERROR) {
        console.log(prettifyJson(message.data))
        return
      }
    },
    { fetch: true }
github dfuse-io / client-js / examples / reference / stream-action-traces.ts View on Github external
*    {
         *      "op": "REM",
         *      "action_idx": 2,
         *      "opayer": "trustdicewin",
         *      "path": "trustdicewin/trustdicewin/hash/......1iwm13h",
         *      "old": "90bd994111e45fc947f7f7d4823081cdf13d05c12f31bf2049aec55e170aa0bcbf66c85c00000000"
         *    },
         *  ]
         * }
         * ```
         */
        console.log(prettifyJson(message.data))
        return
      }

      if (message.type === InboundMessageType.ERROR) {
        console.log(prettifyJson(message.data))
        return
      }
    }
  )
github dfuse-io / client-js / examples / reference / stream-transaction.ts View on Github external
(message: InboundMessage) => {
      if (message.type === InboundMessageType.LISTENING) {
        console.log(prettifyJson(message.data))
        return
      }

      if (message.type === InboundMessageType.TRANSACTION_LIFECYCLE) {
        console.log(prettifyJson(message.data))
        return
      }

      if (message.type === InboundMessageType.ERROR) {
        console.log(prettifyJson(message.data))
        return
      }
    }
  )
github dfuse-io / dfuse-eosio / eosq / src / streams / account-listeners.ts View on Github external
(message: InboundMessage) => {
      if (message.type === InboundMessageType.ERROR) {
        errorCallback(message.data as ErrorData)
        return
      }

      if (!isInboundMessageType(message, "account")) {
        return
      }

      let { account } = message.data as { account: Account }
      let producerInfo: any

      const rexParams: GetTableRowParams = {
        json: true,
        scope: "eosio",
        table: "rexbal",
        code: "eosio",
github dfuse-io / dfuse-eosio / eosq / src / streams / transaction-listeners.ts View on Github external
(message: InboundMessage) => {
      if (message.type === InboundMessageType.ERROR) {
        errorCallback(message.data as ErrorData)
        return
      }

      if (message.type === InboundMessageType.TRANSACTION_LIFECYCLE) {
        successCallback((message.data as TransactionLifecycleData).lifecycle)
      }
    }
  )
github dfuse-io / dfuse-eosio / eosq / src / streams / vote-listener.ts View on Github external
return streamVoteTally(getDfuseClient(), (message: InboundMessage) => {
    if (message.type === InboundMessageType.ERROR) {
      errorCallback(message.data as ErrorData)
    }

    if (isInboundMessageType(message, "vote_tally")) {
      voteStore.update((message.data as VoteTallyData).vote_tally)
    }
  })
}