mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Better websockets reconnect logic
This commit is contained in:
parent
7464cdc748
commit
2c7c466bb9
@ -318,6 +318,7 @@
|
|||||||
function initialize_embed(guildobj) {
|
function initialize_embed(guildobj) {
|
||||||
if (socket) {
|
if (socket) {
|
||||||
socket.disconnect();
|
socket.disconnect();
|
||||||
|
socket = null;
|
||||||
}
|
}
|
||||||
if (guildobj === undefined) {
|
if (guildobj === undefined) {
|
||||||
var guild = query_guild();
|
var guild = query_guild();
|
||||||
@ -856,8 +857,9 @@
|
|||||||
if (socket) {
|
if (socket) {
|
||||||
run_fetch_routine();
|
run_fetch_routine();
|
||||||
socket.disconnect();
|
socket.disconnect();
|
||||||
initiate_websockets();
|
socket = null;
|
||||||
}
|
}
|
||||||
|
initiate_websockets();
|
||||||
});
|
});
|
||||||
usr.fail(function(data) {
|
usr.fail(function(data) {
|
||||||
if (data.status == 429) {
|
if (data.status == 429) {
|
||||||
@ -938,12 +940,13 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on("disconnect", function () {
|
socket.on("disconnect", function () {
|
||||||
socket = null;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("revoke", function () {
|
socket.on("revoke", function () {
|
||||||
|
socket.disconnect();
|
||||||
|
socket = null;
|
||||||
$('#loginmodal').modal('open');
|
$('#loginmodal').modal('open');
|
||||||
setVisitorMode(true);
|
|
||||||
primeEmbed();
|
primeEmbed();
|
||||||
Materialize.toast('Authentication error! You have been disconnected by the server.', 10000);
|
Materialize.toast('Authentication error! You have been disconnected by the server.', 10000);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user