• User Guide
    • Security Notes
      Security Notes
    • Online/Desktop Apps
      • Account Management
        • Create Account
          Create Account
        • Log in to Account
          Log in to Account
        • Backup Seed Phrase
          Backup Seed Phrase
        • Recover Account
          Recover Account
        • Find Out Your Address
          Find Out Your Address
        • Create Personal Alias
          Create Personal Alias
        • Import From Keeper Wallet
          Import From Keeper Wallet
        • Use Ledger Nano Devices With WX Network
          Use Ledger Nano Devices With WX Network
        Account Management
      • Token Management
        • Deposit & Withdraw Tokens
          • Transactions Tab
            Transactions Tab
          Deposit & Withdraw Tokens
        • Create Token
          Create Token
        • Mass Transfer
          Mass Transfer
        • Reissue Token
          Reissue Token
        • Change Reissuable to Not Reissuable
          Change Reissuable to Not Reissuable
        • Burn Token
          Burn Token
        • Sponsored Transaction
          Sponsored Transaction
        • Sponsored Fee
          Sponsored Fee
        • Swap Tokens
          Swap Tokens
        Token Management
      • Investment Tools
        • Stake Tokens
          • How to Get XTN (Quick Guide)
            How to Get XTN (Quick Guide)
          • How to Get USDT/USDC/BTC/ETH (Quick Guide)
            How to Get USDT/USDC/BTC/ETH (Quick Guide)
          Stake Tokens
        • Lambo Investments
          Lambo Investments
        • Algorithmic Trading
          Algorithmic Trading
        Investment Tools
      • Liquidity Pools
        • How to Maximize Passive Income from Liquidity Pools?
          How to Maximize Passive Income from Liquidity Pools?
        • How to Deposit/Withdraw Tokens to/from a Liquidity Pool?
          How to Deposit/Withdraw Tokens to/from a Liquidity Pool?
        • How to Stake/Unstake LP Tokens?
          How to Stake/Unstake LP Tokens?
        • How to Claim LP Staking Reward in WX?
          How to Claim LP Staking Reward in WX?
        • How to Stake WX Token to Boost LP Staking Reward?
          How to Stake WX Token to Boost LP Staking Reward?
        • How to Claim WX Staking Reward?
          How to Claim WX Staking Reward?
        • WX Token Protocol
          WX Token Protocol
        Liquidity Pools
      • Voting
        Voting
      • Advanced Features
        • Script Transaction
          Script Transaction
        • JSON Confirmation
          JSON Confirmation
        Advanced Features
      • Start Trading on WX Network
        Start Trading on WX Network
      Online/Desktop Apps
    • Mobile Apps
      • WX Network App
        WX Network App
      • Waves.Exchange App
        • Account Management
          • Create Account
            Create Account
          • Log in to Account
            Log in to Account
          • Recover Account
            Recover Account
          • Find Out Your Address
            Find Out Your Address
          • Create Personal Alias
            Create Personal Alias
          Account Management
        • Token Management
          • Deposit & Withdraw Tokens
            Deposit & Withdraw Tokens
          • Burn Token
            Burn Token
          Token Management
        • Start Trading on WX Network
          Start Trading on WX Network
        Waves.Exchange App
      • WX Invest App
        WX Invest App
      Mobile Apps
    • Working With MetaMask in Waves Network
      Working With MetaMask in Waves Network
    • WX Referral Program
      WX Referral Program
    User Guide
  • API and Library
    • CCXT
      CCXT
    • Fees
      Fees
    • Payment API
      Payment API
    • Web Auth API
      Web Auth API
    • Gateway API
      • Deposit
        • [Deprecated] GET /v1/deposit/addresses/{currency}
          [Deprecated] GET /v1/deposit/addresses/{currency}
        • GET /v1/deposit/addresses/{currency}/{platform}
          GET /v1/deposit/addresses/{currency}/{platform}
        • GET /v1/deposit/currencies
          GET /v1/deposit/currencies
        • [Deprecated] GET /v1/deposit/currencies/{currency}
          [Deprecated] GET /v1/deposit/currencies/{currency}
        • GET /v1/deposit/currencies/{currency}/{platform}
          GET /v1/deposit/currencies/{currency}/{platform}
        • Terms of Deposit
          Terms of Deposit
        Deposit
      • Withdraw
        • [Deprecated] GET /v1/withdraw/addresses/{currency}/{address}
          [Deprecated] GET /v1/withdraw/addresses/{currency}/{address}
        • GET /v1/withdraw/addresses/{currency}/{address}/{platform}
          GET /v1/withdraw/addresses/{currency}/{address}/{platform}
        • GET /v1/withdraw/currencies
          GET /v1/withdraw/currencies
        • [Deprecated] GET /v1/withdraw/currencies/{currency}
          [Deprecated] GET /v1/withdraw/currencies/{currency}
        • GET /v1/withdraw/currencies/{currency}/{platform}
          GET /v1/withdraw/currencies/{currency}/{platform}
        • Terms of Withdrawal
          Terms of Withdrawal
        Withdraw
      • Movements History
        Movements History
      • Platforms List
        Platforms List
      • Error Codes
        Error Codes
      Gateway API
    • Access Token
      • Get Access Token in WX Network App
        Get Access Token in WX Network App
      • POST /v1/oauth2/token
        POST /v1/oauth2/token
      Access Token
    • Get Trades
      Get Trades
    • Staking Annual Percentage Yield API
      Staking Annual Percentage Yield API
    • Matcher
      • WX Network Protocol
        WX Network Protocol
      • Matcher Fee
        Matcher Fee
      • Install Matcher on Ubuntu From Deb-package
        Install Matcher on Ubuntu From Deb-package
      • Matcher Settings
        Matcher Settings
      • Matcher API
        • Order Validation
          Order Validation
        • Exchange Transation Validation
          Exchange Transation Validation
        Matcher API
      • Matcher WebSocket API
        • Errors and Debugging
          Errors and Debugging
        • Common Streams
          Common Streams
        Matcher WebSocket API
      Matcher
    API and Library
  • Glossary
    Glossary
      • English
      • Русский
      On this page
        • Base URLs
        • Terminology
        • Ping/Pong
          • FAQ

          # Matcher WebSocket API

          Matcher supports WebSocket communications protocol (opens new window) and provides WebSocket API. The protocol enables interaction between a web browser (or other client application) and a web server, facilitating real-time data transfer from and to the Server. Most browsers including Google Chrome, Microsoft Edge, Internet Explorer, Firefox, Safari and Opera support the protocol.

          Messages received from the Matcher are represented as JSON objects that can contain letters or letter combinations, for example "t", "Q". These fields are intended to be processed by the Client; JSON objects can also contain symbols, such as "%" or "_". Such symbols are not recommended to be used in the Client, as they are used for internal purposes an may be changed at any time. The type of message can be reviewed in the "T" field.

          # Base URLs

          MainNet: wss://matcher.waves.exchange/ws

          TestNet: wss://matcher-testnet.waves.exchange/ws

          # Terminology

          snapshot - the current state that is sent only once immediately after connecting via WebSocket.

          updates - the updated state of the object after any activities of the matcher. updates and snapshot have similar format of the fields, except for updates contains only the updated fields. The Client should apply the changes to the object from updates to get the latest state. The changes must be applied in the same order as they are received.

          domain message - a message that belongs to the entities representing the domain part, such as order books, addresses etc.

          system message - a message that belongs to Matcher and require specific actions from the Client. For example, Ping request requires the reply Pong, while both are system messages.

          # Ping/Pong

          Ping/pong is a stream of system messages allowing to find out whether the connection in up. The stream also keeps the connection alive.

          Operation algorithm:

          • Once every N seconds the Matcher sends Ping with some payload via the WebSocket connection;

          • The Client must reply with Pong with the same payload;

          • If the Pong with the same payload does not return to the Matcher in M seconds - the Matcher disconnects;

          • Matcher always expects Pong message with the payload similar to the latest Ping and ignores Pong messages with wrong payload;

          N and M values are set by the Matcher.

          Ping and Pong have similar format. The format can change, however the message type cannot change. So basically, when a Client receives Ping it must reply with the same message to the Matcher.

          Ping/Pong is implemented in the same manner for all the streams.

          Example:

          {
            "T": "pp",
            "_": 1585148910776
          }
          

          In this example:

          pp is the message type that stands for Pong/Pong.

          1585148910776 is Unix timestamp of update in milliseconds. This field is only for debugging.

          # FAQ

          Q: Why Ping/Pong frames described in RFC are not used?

          A: Unfortunately, WebSocket for browsers has no access to Control frames (opens new window).

          Q: Why Ping is sent from Matcher, but not from the Client?

          A: We follow recommendation of the spec document (opens new window)

          User agents must not use pings or unsolicited pongs to aid the server; it is assumed that servers will solicit pongs whenever appropriate for the server's needs.

          See also:

          Errors and Debugging

          Common Streams

          Exchange Transation Validation
          Errors and Debugging
          Exchange Transation Validation
          Errors and Debugging