Skip to content

Commit b5662df

Browse files
authored
respong to ping on LBank trades stream (#764)
- ping pong
1 parent 686e9d7 commit b5662df

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/ExchangeSharp/API/Exchanges/LBank/ExchangeLBankAPI.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,24 @@ protected override async Task<IWebSocket> OnGetTradesWebSocketAsync(Func<KeyValu
572572
}
573573
else throw new APIException(token["message"].ToStringInvariant());
574574
}
575+
if (token["action"].ToStringInvariant() == "ping")
576+
{/* # ping
577+
{
578+
"action":"ping",
579+
"ping":"0ca8f854-7ba7-4341-9d86-d3327e52804e"
580+
}
581+
# pong
582+
{
583+
"action":"pong",
584+
"pong":"0ca8f854-7ba7-4341-9d86-d3327e52804e"
585+
} */
586+
var pong = new
587+
{
588+
action = "pong",
589+
pong = token["ping"].ToStringInvariant(),
590+
};
591+
await _socket.SendMessageAsync(pong);
592+
}
575593
else if (token["type"].ToStringInvariant() == "trade")
576594
{
577595
var trade = token["trade"].ParseTrade("amount", "price", "direction", "TS", TimestampType.Iso8601China, null);

0 commit comments

Comments
 (0)