LogoLogo
CSPR.build Portal
1.2.x
1.2.x
  • Documentation
    • Introduction
    • Overview
      • Authorization
      • Rate limits and quotas
      • Pagination
      • Sorting
      • Filtering
      • Optional properties
      • Errors
    • Getting started
    • Highlights
      • Including related entities
      • Including CSPR rates
      • Including account info
      • Accessing auction data
      • Accessing token data
      • Accessing NFT data
      • De-anonymizing account hashes
      • De-anonymizing account purses
      • Receiving contract-level events
    • Changelog
  • REST API
    • Reference
    • Account
      • Get account
      • Get accounts
    • Account Info
      • Get account info
      • Get account infos
    • Auction metrics
      • Get auction metrics
    • Awaiting deploy
      • Create Awaiting Deploy
      • Add Awaiting Deploy signatures
      • Get Awaiting Deploy
    • Block
      • Get block
      • Get blocks
      • Get validator blocks
    • Bidder
      • Get bidder
      • Get bidders
    • Centralized account info
      • Get centralized account info
      • Get centralized account infos
    • Contract
      • Get contract
      • Get contracts
      • Get contracts by contract package
      • Get contract types
    • Contract entry point
      • Get contract entry points
      • Get contract entry point costs
    • Contract package
      • Get contract package
      • Get contract packages
      • Get account contract packages
    • Delegation
      • Get account delegations
      • Get validator delegations
    • Delegator reward
      • Get account delegator rewards
      • Get total account delegation rewards
      • Get total validator delegators' rewards
    • Deploy
      • Get deploy
      • Get deploys
      • Get account deploys
      • Get block deploys
      • Get deploy execution types
    • Fungible token action
      • Get fungible token actions
      • Get fungible token action types
      • Get account fungible token actions
      • Get contract package fungible token actions
    • Fungible token ownership
      • Get account fungible token ownership
      • Get contract package fungible token ownership
    • Non-fungible token (NFT)
      • Get NFT
      • Get account NFTs
      • Get contract package NFTs
      • Get NFT standards
      • Get off-chain NFT metadata statuses
    • Non-fungible token (NFT) action
      • Get contract package NFT actions for a token
      • Get account NFT actions
      • Get contract package NFT actions
      • Get NFT action types
    • Non-fungible token (NFT) ownership
      • Get contract package NFT ownership
      • Get account NFT ownership
    • CSPR rate
      • Get the current currency rate
      • Get historical currency rates
      • Get currencies
    • CSPR supply
      • Get supply
    • Transfer
      • Get account transfers
      • Get deploy transfers
    • Validator
      • Get validator
      • Get validators
    • Validator performance
      • Get historical validator performance
      • Get historical average validator performance
      • Get historical average validators performance
    • Validator reward
      • Get validator rewards
      • Get validator total rewards
  • Streaming API
    • Reference
    • Account balance
    • Block
    • Contract
    • Contract package
    • Contract-level events
    • Deploy
    • Fungible token action
    • Non-fungible token (NFT)
    • Non-fungible token (NFT) action
    • Transfer
  • Casper Node API
    • Connecting with an SDK
Powered by GitBook
On this page
  • Format
  • Persistent sessions (beta)
  • Streams
  • Prerequisites
  1. Streaming API

Reference

The Streaming API allows you to subscribe to the events related to the corresponding entities via the WebSocket interface. As we prioritize even delivery over redundancy, in some rare cases, the same event may arrive twice. Make sure to track the unique source of the event, like deploy hash and event id, where needed.

The update events are emitted only when the direct entity properties are changed. Changes in the optional fields will not trigger a WebSocket message.

Streaming API connection may close when a new version of the API is deployed; thus, make sure to include the reconnection logic in your code.

Format

The messages are sent as JSON objects with the following properties:

Property
Type
Description

action

string

Action name

data

Entity

Affected entity

timestamp

datetime

Timestamp of the network object, deploy or block, that triggered the action

extra

mixed

Extra data provided with the message. This property is optional.

Persistent sessions (beta)

Applications may experience failures on their end, resulting in closing the WebSocket connections. To ensure no messages are lost during the downtime, it's possible to declare the WebSocket connection as "persistent" by adding a Persistent-Session header. Reconnecting with the same Persistent-Session header value would connect the application to the same queue containing the messages received during the downtime.

Persistent Streaming API sessions not available for the "Free" tier

Streams

Below is a full list of the available CSPR.cloud Streaming API streams:

Stream
Actions
Description

updated

created

created

created, updated

emitted

Notifies about newly emitted contract-level events

created

created

created, updated

created

created

Prerequisites

npm install -g wscat
PreviousGet validator total rewardsNextAccount balance

Last updated 10 months ago

Notifies about newly created or updated

Notifies about newly created

Notifies about newly created

Notifies about newly created or updated

Notifies about newly created

Notifies about newly created

Notifies about newly created or updated

Notifies about newly created

Notifies about newly created

To follow Streaming API examples you'll need to install the NPM utility:

wscat
Account balance
Accounts
Block
Blocks
Contract
Contracts
Contract package
Contract packages
Contract-level events
Deploy
Deploys
Fungible token action
Fungible token actions
Non-fungible token (NFT)
NFTs
Non-fungible token (NFT) action
NFT actions
Transfer
Transfers