Dexilon API Documentation
  • 👋Getting Started
  • General Info
    • ⚙️General API information
      • Base URLs
      • HTTP Return Codes
      • Enum Definition
    • 💻Clients
      • Dexilon Chain Client
    • 🚦Limits
      • REST API Rate limits
      • WS Stream Rate Limits
    • 🔐Security
      • Registration Flow
      • Authentication Flow
      • Sending Dexilon Transactions
      • Private API Calls
        • Access Token
        • Refresh Access Token
      • Timing security
    • ⚠️Error Codes
      • REST API Error Codes
      • WS Stream Error Codes
    • 🔍Audits
      • Bridge Audit
      • Smart-Contract Audit
  • Restful API
    • 📊Market Data Endpoints
      • Test Connectivity
      • Check Server Time
      • Exchange Information
      • Order Book
      • Recent Trades List
      • Kline/Candlestick Data
      • Symbol Data
      • Funding Rate History
      • Open Interest
      • Taker Buy/Sell Volume
      • Index Price History
      • Fee Tiers Structure
      • Fee Tiers Discount
      • Symbol Rules
      • Leverage Rules
    • ⚒️Account and Trades Endpoints
      • 🔒Account Information
      • 🔒Get User Address
      • 🔒Positions Information
      • 🔒Assets Information
      • 🔒Change Initial Leverage
      • 🔒Change Margin Type
      • 🔒Modify Isolated Position Margin
      • 🔒Create Withdrawal
      • 🔒Create market order
      • 🔒Create limit order
      • 🔒Cancel Order
      • 🔒Cancel All Orders
      • 🔒Query Order
      • 🔒Get Open Orders
      • 🔒Get Order History
      • 🔒Get Trade History
      • 🔒Get Transaction History
    • 🏆Rewards Endpoints
      • Current Reward Round
      • Reward Distribution
      • Rewards Settings
      • Current Tournament
      • Tournament Members
      • 🔒User's Reward Distributions
      • 🔒User's Reward Round Profit
      • 🔒User's Tournament Rating
    • 💸Liquidation Auctions Endpoints
      • Open Lots
      • Lot History
      • 🔒Place Bid
  • WebSocket Streams
    • 📈Market Data WS Streams
      • Working with Public Streams
      • Mark Price Stream
      • Mark Price Stream For All Markets
      • Kline/Candlestick Stream
      • Ticker Stream
      • Ticker Stream For All Markets
      • Partial Book Depth Stream
      • Book Ticker Stream
      • Trade Stream
      • Aggregate Trade Stream
      • Liquidation Trade Stream
      • Liquidation Auction Stream
    • 👥User Data WS Stream
      • 🔒Working with Private Streams
      • 🔒Order Update Stream
      • 🔒Account Update Stream
      • 🔒L2 Account Update Stream
Powered by GitBook
On this page
  • Request → Receipt Confirmation → Stream (continuous feed)
  • Subscribing
  • Unsubscribing
  • Unsubscribing from all
  • Ping/Pong
  • Extending Session's Time
  1. WebSocket Streams
  2. Market Data WS Streams

Working with Public Streams

You can send various Requests to Streams. From Streams, you can receive Replies to your Requests and various Stream Events that you have subscribed to.

Request → Receipt Confirmation → Stream (continuous feed)

The following data can be sent through the web-socket instance. Examples can be seen below.

All Replies and Stream Events has two required fields: eventType - needed to determine the type of event on the client side, in accordance with it, you can process it correctly

eventTime - the time when the message was sent to the stream, with it you can process messages based not only on the actual time of acceptance, excluding network delays

{   
    "eventType": "subscribe",
    "eventTime": 1679491892027,
    ...
}

Subscribing

→ Request:

{
    "method" : "SUBSCRIBE", 
    "params" : [ "markPrice", "btc_usdc@orderBook", "!ticker_arr" ]
}

<- Receipt Confirmation:

{
    "eventType": "subscribe",
    "eventTime": 1679491892027,
    "topics": [ "markPrice", "btc_usdc@orderBook", "!ticker_arr" ]
}

Unsubscribing

→ Request:

{
    "method" : "UNSUBSCRIBE", 
    "params" : [ "markPrice", "btc_usdc@orderBook", "!ticker_arr" ]
}

<- Receipt Confirmation:

{
    "eventType": "unsubscribe",
    "eventTime": 1679491892027,
    "topics": [ "markPrice", "btc_usdc@orderBook", "!ticker_arr" ]
}

Unsubscribing from all

→ Request:

{
    "method" : "UNSUBSCRIBE_ALL"
}

<- Receipt Confirmation:

{
    "eventType": "unsubscribe",
    "eventTime": 1679491892027,
    "topics": [ "markPrice", "btc_usdc@orderBook", "!ticker_arr" ]
}

Ping/Pong

→ Request:

{
    "method" : "PING"
}

<- Receipt Confirmation:

{
    "eventType": "pong",
    "eventTime": 1679491892027
}

Extending Session's Time

One connection of the public (market) Stream is valid indefinitely. The connection becomes invalid if the connection is lost or if the session is not extended in time.

<- To warn about expiration of session server send event:

{
    "eventType": "expiredSessionWarning",
    "eventTime": 1679491892027
}

For extending session's time you need to send this event as a reply:

→ Request:

{
    "method" : "EXTEND_SESSION", 
    "params" : [ "MIN_5" ]
}

<- Receipt Confirmation:

{
    "eventType": "extendSession",
    "eventTime": 1679491892027,
    "isExtended" : true
}
PreviousMarket Data WS StreamsNextMark Price Stream

Last updated 2 years ago

📈