Liquid API
Search…
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.
1
const ws = new WebSocket('wss://tap.liquid.com/app/LiquidTapClient');
2
3
const tapPing = {
4
event: "pusher:ping",
5
data: { }
6
}
7
const tapPingPayload = JSON.stringify(tapPing);
8
9
setInterval(
10
() => (ws.send(tapPingPayload)),
11
60000
12
);
Copied!
Last modified 10mo ago
Copy link