• APIs and Libraries
    APIs and Libraries
  • Connect WX Network wallet
    Connect WX Network wallet
  • CCXT
    CCXT
  • Fees
    Fees
  • 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
  • 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
    • 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
  • Get Trades
    Get Trades
  • Staking Annual Percentage Yield API
    Staking Annual Percentage Yield API
  • Payment API
    Payment API
  • Web Auth API
    Web Auth API
  • WX Token Protocol
    WX Token Protocol
  • 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