streaming: socket.addEventListener('open', ...) --> socket.onopen, etc
This commit is contained in:
parent
a93d77c851
commit
9da03aa053
|
@ -42,8 +42,7 @@ const streamingController: AppController = (c) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.addEventListener('open', async () => {
|
socket.onopen = async () => {
|
||||||
console.log('websocket: connection opened');
|
|
||||||
if (!stream) return;
|
if (!stream) return;
|
||||||
|
|
||||||
ws.subscribe(conn, { stream });
|
ws.subscribe(conn, { stream });
|
||||||
|
@ -58,14 +57,11 @@ const streamingController: AppController = (c) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
socket.addEventListener('message', (e) => console.log('websocket message: ', e.data));
|
socket.onclose = () => {
|
||||||
|
|
||||||
socket.addEventListener('close', () => {
|
|
||||||
console.log('websocket: connection closed');
|
|
||||||
ws.unsubscribeAll(socket);
|
ws.unsubscribeAll(socket);
|
||||||
});
|
};
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue