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"]) {
|
if (json["urls"]["streaming_api"]) {
|
||||||
localStorage.setItem("streaming_" + acct_id, 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) {
|
websocketNotf[acct_id].onerror = function (error) {
|
||||||
console.error('WebSocket Error ' + error);
|
console.error('WebSocket Error ' + error);
|
||||||
notfWS(misskey, acct_id, tlid, domain, at)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,23 +375,23 @@ function notfToggle(acct, tlid) {
|
||||||
$("#notf-box_" + tlid).animate({
|
$("#notf-box_" + tlid).animate({
|
||||||
'height': '400px'
|
'height': '400px'
|
||||||
}, {
|
}, {
|
||||||
'duration': 300,
|
'duration': 300,
|
||||||
'complete': function () {
|
'complete': function () {
|
||||||
$("#notf-box_" + tlid).css("overflow-y", "scroll")
|
$("#notf-box_" + tlid).css("overflow-y", "scroll")
|
||||||
$("#notf-box_" + tlid).removeClass("column-hide")
|
$("#notf-box_" + tlid).removeClass("column-hide")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$("#notf-box_" + tlid).css("overflow-y", "hidden")
|
$("#notf-box_" + tlid).css("overflow-y", "hidden")
|
||||||
$("#notf-box_" + tlid).animate({
|
$("#notf-box_" + tlid).animate({
|
||||||
'height': '0'
|
'height': '0'
|
||||||
}, {
|
}, {
|
||||||
'duration': 300,
|
'duration': 300,
|
||||||
'complete': function () {
|
'complete': function () {
|
||||||
$("#notf-box_" + tlid).addClass("column-hide")
|
$("#notf-box_" + tlid).addClass("column-hide")
|
||||||
$("#notf-box_" + tlid).css("display", "none")
|
$("#notf-box_" + tlid).css("display", "none")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
notfCanceler(acct)
|
notfCanceler(acct)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
//TL取得
|
//TL取得
|
||||||
moreloading = false;
|
moreloading = false;
|
||||||
|
var errorct=0;
|
||||||
function tl(type, data, acct_id, tlid, delc, voice, mode) {
|
function tl(type, data, acct_id, tlid, delc, voice, mode) {
|
||||||
scrollevent();
|
scrollevent();
|
||||||
$("#unread_" + tlid + " .material-icons").removeClass("teal-text")
|
$("#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] = new WebSocket(start);
|
||||||
websocket[wsid].onopen = function (mess) {
|
websocket[wsid].onopen = function (mess) {
|
||||||
console.table({ "tlid": tlid, "type": "Connect Streaming API" + type, "domain": domain, "message": [mess] })
|
console.table({ "tlid": tlid, "type": "Connect Streaming API" + type, "domain": domain, "message": [mess] })
|
||||||
|
errorct=0
|
||||||
$("#notice_icon_" + tlid).removeClass("red-text")
|
$("#notice_icon_" + tlid).removeClass("red-text")
|
||||||
}
|
}
|
||||||
websocket[wsid].onmessage = function (mess) {
|
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")
|
$("#notice_icon_" + tlid).addClass("red-text")
|
||||||
todo('WebSocket Error ' + error);
|
todo('WebSocket Error ' + error);
|
||||||
} else {
|
} else {
|
||||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
errorct++;
|
||||||
localStorage.setItem("wserror_" + tlid, errorct);
|
console.log(errorct)
|
||||||
if (errorct < 3) {
|
if (errorct < 3) {
|
||||||
reconnector(tlid, type, acct_id, data, "error");
|
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")
|
$("#notice_icon_" + tlid).addClass("red-text")
|
||||||
todo('WebSocket Closed');
|
todo('WebSocket Closed');
|
||||||
} else {
|
} else {
|
||||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
errorct++;
|
||||||
localStorage.setItem("wserror_" + tlid, errorct);
|
console.log(errorct)
|
||||||
if (errorct < 3) {
|
if (errorct < 3) {
|
||||||
reconnector(tlid, type, acct_id, data, "error");
|
reconnector(tlid, type, acct_id, data, "error");
|
||||||
}
|
}
|
||||||
|
@ -791,7 +793,6 @@ function strAlive() {
|
||||||
var type = obj[key].type;
|
var type = obj[key].type;
|
||||||
var acct_id = obj[key].domain;
|
var acct_id = obj[key].domain;
|
||||||
var data = obj[key].data;
|
var data = obj[key].data;
|
||||||
localStorage.removeItem("wserror_" + tlid)
|
|
||||||
reconnector(key, type, acct_id, data, "error");
|
reconnector(key, type, acct_id, data, "error");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user