fix: use addEventListener, on is not available in all environments
This commit is contained in:
parent
7d466b17c3
commit
c4c0a947a9
|
@ -74,7 +74,7 @@ export async function subscribeToEntry(
|
||||||
|
|
||||||
const socket = new WS(wsUrl);
|
const socket = new WS(wsUrl);
|
||||||
|
|
||||||
socket.on("open", () => {
|
socket.addEventListener("open", () => {
|
||||||
const packer = new Packer();
|
const packer = new Packer();
|
||||||
packer.pack(2);
|
packer.pack(2);
|
||||||
packer.pack(publicKey);
|
packer.pack(publicKey);
|
||||||
|
@ -84,8 +84,8 @@ export async function subscribeToEntry(
|
||||||
|
|
||||||
return {
|
return {
|
||||||
listen(cb: (entry: SignedRegistryEntry) => void) {
|
listen(cb: (entry: SignedRegistryEntry) => void) {
|
||||||
socket.on("message", (data) => {
|
socket.addEventListener("message", (data) => {
|
||||||
cb(deserializeRegistryEntry(new Uint8Array(data as Buffer)));
|
cb(deserializeRegistryEntry(new Uint8Array(data.data as Buffer)));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
end() {
|
end() {
|
||||||
|
|
Loading…
Reference in New Issue