Liquid API
  • Introduction
  • Version History
  • Rate Limiting
  • Authentication
  • Response Data
  • Errors
  • Pagination
  • Public Rest API
    • Product Data
    • Loan Book
    • Fees
  • Private REST API
    • Get Orders
    • Create Orders
    • Edit Orders
    • Cancel Orders
    • Executions
    • Transactions
    • Trading
    • Fiat
    • Crypto
    • Loans
    • Fee Tier
    • Accounts
  • Websocket (Liquid Tap)
    • Introduction
    • Authentication
    • Public Channels
    • Private Channels
    • Ping Pong
  • OAuth
    • OAuth
Powered by GitBook
On this page

Was this helpful?

  1. Websocket (Liquid Tap)

Ping Pong

Note: When using the provided JS this section can be ignored.

LiquidTap requires some activity on the websocket every 120 seconds or it will forcibly close the connection. To ensure the connection doesn’t get closed, it is advisable to send a ping every 60 seconds. In the provided JS library this is taken care of through a local interval timer. However, when building a custom integration this will need to be taken into account.

PING (SEND EVERY 60 SECONDS)

{"event":"pusher:ping","data":{}}

PONG (SERVER RESPONSE)

{"event":"pusher:pong","data":{}}

It is the responsibility of the client to initiate the ping/pong event. The server will never ping the client.

const ws = new WebSocket('wss://tap.liquid.com/app/LiquidTapClient');

const tapPing = {
  event: "pusher:ping",
  data: { }
}
const tapPingPayload = JSON.stringify(tapPing);

setInterval(
  () => (ws.send(tapPingPayload)),
  60000
);
PreviousPrivate ChannelsNextOAuth

Last updated 4 years ago

Was this helpful?