Skip to content

Commit

Permalink
Merge pull request #4 from PWhiddy/PWhiddy-patch-1
Browse files Browse the repository at this point in the history
remove-old-ws
  • Loading branch information
PWhiddy authored Feb 16, 2024
2 parents 00888e3 + 08f3952 commit f33683a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions visualizer_live.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const app = new PIXI.Application({
}
});

let socketOld = null;
let socket = null;

let lastFrameTime = Date.now();
Expand Down Expand Up @@ -179,10 +178,7 @@ PIXI.Assets.load([

const refreshWS = () => {
console.log("Refreshing WebSocket connection.");
if (socketOld !== null) {
socketOld.close(); // Close the current connection
}
socketOld = initializeWebSocket("wss://poke-ws-test-ulsjzjzwpa-ue.a.run.app/receive"); // Reinitialize the connection
// Reinitialize the connection
if (socket !== null) {
socket.close(); // Close the current connection
}
Expand Down

0 comments on commit f33683a

Please sign in to comment.