mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
Websocket ping message for notifications and vault
This commit is contained in:
parent
6674d76d6d
commit
5c8e62bd90
@ -207,6 +207,8 @@
|
||||
try {
|
||||
socket = new WebSocket(ws_uri);
|
||||
socket.onmessage = function (e) {
|
||||
if (e.data === "ping")
|
||||
return;
|
||||
$.get(newDataEndpoint, function (data) {
|
||||
$("#notifications-nav-item").replaceWith($(data));
|
||||
});
|
||||
|
@ -37,7 +37,7 @@ namespace BTCPayServer
|
||||
var newSize = _Buffer.Array.Length;
|
||||
while (true)
|
||||
{
|
||||
var message = await Socket.ReceiveAsync(buffer, cancellation);
|
||||
var message = await Socket.ReceiveAndPingAsync(buffer, cancellation);
|
||||
if (message.MessageType == WebSocketMessageType.Close)
|
||||
{
|
||||
await CloseSocketAndThrow(WebSocketCloseStatus.NormalClosure, "Close message received from the peer", cancellation);
|
||||
|
@ -20,6 +20,8 @@ var vault = (function () {
|
||||
};
|
||||
this.socket.onmessage = function (event) {
|
||||
if (typeof event.data === "string") {
|
||||
if (event.data === "ping")
|
||||
return;
|
||||
var jsonObject = JSON.parse(event.data);
|
||||
if (jsonObject.hasOwnProperty("params")) {
|
||||
var request = new XMLHttpRequest();
|
||||
|
Loading…
Reference in New Issue
Block a user