Skip to content

Commit

Permalink
Fix this/self shenanigans
Browse files Browse the repository at this point in the history
  • Loading branch information
Quantumplation committed Dec 14, 2024
1 parent e1ac451 commit 76fa872
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/hydra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,21 @@ export class Hydra {
const websocketUrl = new URL(url);
websocketUrl.protocol = websocketUrl.protocol.replace("http", "ws");

let self = this;
this.connection = new WebSocket(
websocketUrl +
(websocketUrl.toString().endsWith("/") ? "" : "/") +
`?${filterAddress ? `address=${filterAddress}&` : ""}history=no`,
);
this.connection.onopen = () => {
console.log("Connected to Hydra");
self.onConnect?.();
onConnect?.();
};
this.connection.onerror = (error) => {
console.error("Error on Hydra websocket: ", error);
};
this.connection.onclose = () => {
console.error("Hydra websocket closed");
self.onDisconnect?.();
onDisconnect?.();
};
this.connection.onmessage = this.receiveMessage.bind(this);
}
Expand Down

0 comments on commit 76fa872

Please sign in to comment.