diff --git a/client/utils/SocketClientHandlers.ts b/client/utils/SocketClientHandlers.ts index 5c11a3e5..70b95c96 100644 --- a/client/utils/SocketClientHandlers.ts +++ b/client/utils/SocketClientHandlers.ts @@ -32,6 +32,7 @@ import { } from '../../server/reducers/channelsReducer' export const socketClientHandlers = () => { + let vuUpdateSpeed = Date.now() window.socketIoClient .on('connect', () => { window.storeRedux.dispatch(storeSetServerOnline(true)) @@ -98,22 +99,27 @@ export const socketClientHandlers = () => { ) }) .on(SOCKET_SET_ALL_VU, (payload: any) => { - payload.vuMeters.forEach((meterLevel: number, index: number) => { - window.storeRedux.dispatch({ - type: SET_VU_LEVEL, - channel: index, - level: meterLevel, - }) - }) - payload.vuReductionMeters.forEach( - (meterLevel: number, index: number) => { - window.storeRedux.dispatch({ - type: SET_VU_REDUCTION_LEVEL, - channel: index, - level: meterLevel, - }) - } - ) + if (Date.now() - vuUpdateSpeed > 100) { + vuUpdateSpeed = Date.now() + payload.vuMeters.forEach( + (meterLevel: number, index: number) => { + window.storeRedux.dispatch({ + type: SET_VU_LEVEL, + channel: index, + level: meterLevel, + }) + } + ) + payload.vuReductionMeters.forEach( + (meterLevel: number, index: number) => { + window.storeRedux.dispatch({ + type: SET_VU_REDUCTION_LEVEL, + channel: index, + level: meterLevel, + }) + } + ) + } }) .on(SOCKET_SET_VU, (payload: any) => { window.storeRedux.dispatch({