TigerTrading's picture
fix all
6e81cb0 verified
raw
history blame contribute delete
697 Bytes
import { createSlice } from '@reduxjs/toolkit';
const initialState = {
connected: false,
latency: 23,
subscriptions: ['system-metrics', 'ai-status', 'notifications'],
lastUpdate: new Date().toISOString()
};
export const websocketSlice = createSlice({
name: 'websocket',
initialState,
reducers: {
websocketConnected: (state) => {
state.connected = true;
},
websocketDisconnected: (state) => {
state.connected = false;
},
updateLatency: (state, action) => {
state.latency = action.payload;
},
},
});
export const { websocketConnected, websocketDisconnected, updateLatency } = websocketSlice.actions;
export default websocketSlice.reducer;