Fix: mugen streaming reconnect
This commit is contained in:
parent
e9cc2d0e52
commit
1e4397ed7b
|
@ -398,6 +398,8 @@ function ckdb(acct_id) {
|
|||
}
|
||||
if (json["urls"]["streaming_api"]) {
|
||||
localStorage.setItem("streaming_" + acct_id, json["urls"]["streaming_api"]);
|
||||
}else{
|
||||
localStorage.removeItem("streaming_" + acct_id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -264,7 +264,21 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
|
|||
}
|
||||
websocketNotf[acct_id].onerror = function (error) {
|
||||
console.error('WebSocket Error ' + error);
|
||||
errorct++;
|
||||
console.log(errorct)
|
||||
if (errorct < 3) {
|
||||
notfWS(misskey, acct_id, tlid, domain, at)
|
||||
}
|
||||
|
||||
};
|
||||
websocketNotf[acct_id].onclose = function (error) {
|
||||
console.error('WebSocket Close ' + error);
|
||||
errorct++;
|
||||
console.log(errorct)
|
||||
if (errorct < 3) {
|
||||
notfWS(misskey, acct_id, tlid, domain, at)
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//TL取得
|
||||
moreloading = false;
|
||||
var errorct=0;
|
||||
function tl(type, data, acct_id, tlid, delc, voice, mode) {
|
||||
scrollevent();
|
||||
$("#unread_" + tlid + " .material-icons").removeClass("teal-text")
|
||||
|
@ -230,6 +231,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
|||
websocket[wsid] = new WebSocket(start);
|
||||
websocket[wsid].onopen = function (mess) {
|
||||
console.table({ "tlid": tlid, "type": "Connect Streaming API" + type, "domain": domain, "message": [mess] })
|
||||
errorct=0
|
||||
$("#notice_icon_" + tlid).removeClass("red-text")
|
||||
}
|
||||
websocket[wsid].onmessage = function (mess) {
|
||||
|
@ -317,8 +319,8 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
|||
$("#notice_icon_" + tlid).addClass("red-text")
|
||||
todo('WebSocket Error ' + error);
|
||||
} else {
|
||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
||||
localStorage.setItem("wserror_" + tlid, errorct);
|
||||
errorct++;
|
||||
console.log(errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, type, acct_id, data, "error");
|
||||
}
|
||||
|
@ -331,8 +333,8 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
|||
$("#notice_icon_" + tlid).addClass("red-text")
|
||||
todo('WebSocket Closed');
|
||||
} else {
|
||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
||||
localStorage.setItem("wserror_" + tlid, errorct);
|
||||
errorct++;
|
||||
console.log(errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, type, acct_id, data, "error");
|
||||
}
|
||||
|
@ -791,7 +793,6 @@ function strAlive() {
|
|||
var type = obj[key].type;
|
||||
var acct_id = obj[key].domain;
|
||||
var data = obj[key].data;
|
||||
localStorage.removeItem("wserror_" + tlid)
|
||||
reconnector(key, type, acct_id, data, "error");
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user