mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-19 19:06:16 +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]);
|
||||
|
||||
const onDisconnect = useCallback(() => {
|
||||
setWsState(WebSocket.CLOSED);
|
||||
if (wsRef.current) {
|
||||
if (wsRef.current && wsState == WebSocket.OPEN) {
|
||||
setWsState(WebSocket.CLOSED);
|
||||
wsRef.current.close();
|
||||
wsRef.current = null;
|
||||
}
|
||||
}, []);
|
||||
}, [wsState]);
|
||||
|
||||
const onOpen = () => {
|
||||
setWsState(WebSocket.OPEN);
|
||||
|
Loading…
Reference in New Issue
Block a user