mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-19 04:00:59 -04:00
Kick connection fixes
This commit is contained in:
+10
-18
@@ -299,6 +299,12 @@ async function KickConnect() {
|
|||||||
|
|
||||||
const websocket = new WebSocket(kickPusherWsUrl);
|
const websocket = new WebSocket(kickPusherWsUrl);
|
||||||
|
|
||||||
|
// Reconnect
|
||||||
|
websocket.onclose = function () {
|
||||||
|
console.log(`Reconnecting to ${kickUsername}...`);
|
||||||
|
setTimeout(connectPusher, 5000);
|
||||||
|
};
|
||||||
|
|
||||||
websocket.onopen = function () {
|
websocket.onopen = function () {
|
||||||
console.log(`Kick successfully conntected to ${kickUsername}.`);
|
console.log(`Kick successfully conntected to ${kickUsername}.`);
|
||||||
}
|
}
|
||||||
@@ -315,24 +321,10 @@ async function KickConnect() {
|
|||||||
console.log(`[Pusher] Socket established with ID: ${socketData.socket_id}`);
|
console.log(`[Pusher] Socket established with ID: ${socketData.socket_id}`);
|
||||||
|
|
||||||
// Now subscribe to a channel
|
// Now subscribe to a channel
|
||||||
let subscribeMessage = {
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `chatroom_${chatroomId}` } }));
|
||||||
event: 'pusher:subscribe',
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `chatrooms.${chatroomId}` } }));
|
||||||
data: {
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `chatrooms.${chatroomId}.v2` } }));
|
||||||
channel: `chatroom_${chatroomId}`
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `predictions-channel-${chatroomId}` } }));
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
websocket.send(JSON.stringify(subscribeMessage));
|
|
||||||
|
|
||||||
// Now subscribe to a channel
|
|
||||||
subscribeMessage = {
|
|
||||||
event: 'pusher:subscribe',
|
|
||||||
data: {
|
|
||||||
channel: `chatrooms.${chatroomId}.v2`
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
websocket.send(JSON.stringify(subscribeMessage));
|
|
||||||
console.log(`[Pusher] Sent subscription request to channel: ${chatroomId}`);
|
console.log(`[Pusher] Sent subscription request to channel: ${chatroomId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-18
@@ -322,6 +322,12 @@ async function KickConnect() {
|
|||||||
|
|
||||||
const websocket = new WebSocket(kickPusherWsUrl);
|
const websocket = new WebSocket(kickPusherWsUrl);
|
||||||
|
|
||||||
|
// Reconnect
|
||||||
|
websocket.onclose = function () {
|
||||||
|
console.log(`Reconnecting to ${kickUsername}...`);
|
||||||
|
setTimeout(connectPusher, 5000);
|
||||||
|
};
|
||||||
|
|
||||||
websocket.onopen = function () {
|
websocket.onopen = function () {
|
||||||
console.log(`Kick successfully conntected to ${kickUsername}.`);
|
console.log(`Kick successfully conntected to ${kickUsername}.`);
|
||||||
}
|
}
|
||||||
@@ -338,24 +344,10 @@ async function KickConnect() {
|
|||||||
console.log(`[Pusher] Socket established with ID: ${socketData.socket_id}`);
|
console.log(`[Pusher] Socket established with ID: ${socketData.socket_id}`);
|
||||||
|
|
||||||
// Now subscribe to a channel
|
// Now subscribe to a channel
|
||||||
let subscribeMessage = {
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `chatroom_${chatroomId}` } }));
|
||||||
event: 'pusher:subscribe',
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `chatrooms.${chatroomId}` } }));
|
||||||
data: {
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `chatrooms.${chatroomId}.v2` } }));
|
||||||
channel: `chatroom_${chatroomId}`
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `predictions-channel-${chatroomId}` } }));
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
websocket.send(JSON.stringify(subscribeMessage));
|
|
||||||
|
|
||||||
// Now subscribe to a channel
|
|
||||||
subscribeMessage = {
|
|
||||||
event: 'pusher:subscribe',
|
|
||||||
data: {
|
|
||||||
channel: `chatrooms.${chatroomId}.v2`
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
websocket.send(JSON.stringify(subscribeMessage));
|
|
||||||
console.log(`[Pusher] Sent subscription request to channel: ${chatroomId}`);
|
console.log(`[Pusher] Sent subscription request to channel: ${chatroomId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -320,6 +320,12 @@ async function KickConnect() {
|
|||||||
|
|
||||||
const websocket = new WebSocket(kickPusherWsUrl);
|
const websocket = new WebSocket(kickPusherWsUrl);
|
||||||
|
|
||||||
|
// Reconnect
|
||||||
|
websocket.onclose = function () {
|
||||||
|
console.log(`Reconnecting to ${kickUsername}...`);
|
||||||
|
setTimeout(connectPusher, 5000);
|
||||||
|
};
|
||||||
|
|
||||||
websocket.onopen = function () {
|
websocket.onopen = function () {
|
||||||
console.log(`Kick successfully conntected to ${kickUsername}.`);
|
console.log(`Kick successfully conntected to ${kickUsername}.`);
|
||||||
}
|
}
|
||||||
@@ -336,24 +342,10 @@ async function KickConnect() {
|
|||||||
console.log(`[Pusher] Socket established with ID: ${socketData.socket_id}`);
|
console.log(`[Pusher] Socket established with ID: ${socketData.socket_id}`);
|
||||||
|
|
||||||
// Now subscribe to a channel
|
// Now subscribe to a channel
|
||||||
let subscribeMessage = {
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `chatroom_${chatroomId}` } }));
|
||||||
event: 'pusher:subscribe',
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `chatrooms.${chatroomId}` } }));
|
||||||
data: {
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `chatrooms.${chatroomId}.v2` } }));
|
||||||
channel: `chatroom_${chatroomId}`
|
websocket.send(JSON.stringify({ event: 'pusher:subscribe', data: { channel: `predictions-channel-${chatroomId}` } }));
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
websocket.send(JSON.stringify(subscribeMessage));
|
|
||||||
|
|
||||||
// Now subscribe to a channel
|
|
||||||
subscribeMessage = {
|
|
||||||
event: 'pusher:subscribe',
|
|
||||||
data: {
|
|
||||||
channel: `chatrooms.${chatroomId}.v2`
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
websocket.send(JSON.stringify(subscribeMessage));
|
|
||||||
console.log(`[Pusher] Sent subscription request to channel: ${chatroomId}`);
|
console.log(`[Pusher] Sent subscription request to channel: ${chatroomId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user