mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Only close MSE websocket when it's already open (#12078)
This commit is contained in:
parent
5c33cdba4e
commit
9f81ce2876
@ -117,12 +117,12 @@ function MSEPlayer({
|
|||||||
}, [wsURL]);
|
}, [wsURL]);
|
||||||
|
|
||||||
const onDisconnect = useCallback(() => {
|
const onDisconnect = useCallback(() => {
|
||||||
|
if (wsRef.current && wsState == WebSocket.OPEN) {
|
||||||
setWsState(WebSocket.CLOSED);
|
setWsState(WebSocket.CLOSED);
|
||||||
if (wsRef.current) {
|
|
||||||
wsRef.current.close();
|
wsRef.current.close();
|
||||||
wsRef.current = null;
|
wsRef.current = null;
|
||||||
}
|
}
|
||||||
}, []);
|
}, [wsState]);
|
||||||
|
|
||||||
const onOpen = () => {
|
const onOpen = () => {
|
||||||
setWsState(WebSocket.OPEN);
|
setWsState(WebSocket.OPEN);
|
||||||
|
Loading…
Reference in New Issue
Block a user