mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
CheckoutV2: When WebSocket disconnects, we should continue polling via XHR (#5165)
* When WebSocket disconnects, we should continue polling via XHR * Update BTCPayServer/wwwroot/checkout-v2/checkout.js Co-authored-by: d11n <mail@dennisreimann.de> --------- Co-authored-by: d11n <mail@dennisreimann.de>
This commit is contained in:
parent
b5f0924651
commit
fd6d361e1a
@ -265,6 +265,7 @@ function initApp() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
listenIn () {
|
listenIn () {
|
||||||
|
const self = this;
|
||||||
let socket = null;
|
let socket = null;
|
||||||
const updateFn = this.fetchData;
|
const updateFn = this.fetchData;
|
||||||
const supportsWebSockets = 'WebSocket' in window && window.WebSocket.CLOSING === 2;
|
const supportsWebSockets = 'WebSocket' in window && window.WebSocket.CLOSING === 2;
|
||||||
@ -279,6 +280,9 @@ function initApp() {
|
|||||||
socket.onerror = function (e) {
|
socket.onerror = function (e) {
|
||||||
console.error('Error while connecting to websocket for invoice notifications (callback):', e);
|
console.error('Error while connecting to websocket for invoice notifications (callback):', e);
|
||||||
};
|
};
|
||||||
|
socket.onclose = function () {
|
||||||
|
self.pollUpdates(2000, socket);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.error('Error while connecting to websocket for invoice notifications', e);
|
console.error('Error while connecting to websocket for invoice notifications', e);
|
||||||
|
Loading…
Reference in New Issue
Block a user