PromucFlow_constructor/app/client/src/actions/websocketActions.ts
Hetu Nandu 4e761eaee2
chore: Refactor rts connection retry with limits (#19781)
Socket connection to the RTS server keep retrying the connection even
when it fails. This change will remove that old logic and add the config
on socket.io itself to have a limit on the number of times this
connection is made.

This will mean we will not get the constant error messages about
connection failure in the console when in dev mode
2023-01-14 21:38:39 +05:30

44 lines
1.2 KiB
TypeScript

import {
ReduxActionTypes,
ReduxSagaChannels,
} from "@appsmith/constants/ReduxActionConstants";
import { reconnectWebsocketEvent } from "constants/WebsocketConstants";
export const setIsAppLevelWebsocketConnected = (payload: boolean) => ({
type: ReduxActionTypes.SET_IS_APP_LEVEL_WEBSOCKET_CONNECTED,
payload,
});
export const setIsPageLevelWebsocketConnected = (payload: boolean) => ({
type: ReduxActionTypes.SET_IS_PAGE_LEVEL_WEBSOCKET_CONNECTED,
payload,
});
export const appLevelWebsocketWriteEvent = (payload: {
type: string;
payload?: any;
}) => ({
type: ReduxSagaChannels.WEBSOCKET_APP_LEVEL_WRITE_CHANNEL,
payload,
});
export const pageLevelWebsocketWriteEvent = (payload: {
type: string;
payload?: any;
}) => ({
type: ReduxSagaChannels.WEBSOCKET_PAGE_LEVEL_WRITE_CHANNEL,
payload,
});
export const reconnectAppLevelWebsocket = () =>
appLevelWebsocketWriteEvent(reconnectWebsocketEvent());
export const initAppLevelSocketConnection = () => ({
type: ReduxActionTypes.INIT_APP_LEVEL_SOCKET_CONNECTION,
});
export const reconnectPageLevelWebsocket = () =>
pageLevelWebsocketWriteEvent(reconnectWebsocketEvent());
export const initPageLevelSocketConnection = () => ({
type: ReduxActionTypes.INIT_PAGE_LEVEL_SOCKET_CONNECTION,
});