Skip to content

Commit

Permalink
feat: update randomization and reconnection delay max
Browse files Browse the repository at this point in the history
  • Loading branch information
djabarovgeorge committed Mar 20, 2024
1 parent 5b7a721 commit e8477dc
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ type IUseInitializeSocket = (args: { socketUrl: string }) => {
disconnectSocket: () => void;
};

const RECONNECTION_DELAY_MAX = 60000 * 5; // 5 minutes
const RANDOMIZATION_FACTOR = 1;

export const useInitializeSocket: IUseInitializeSocket = ({ socketUrl }) => {
const socketRef = useRef<Socket | null>(null);

Expand All @@ -30,7 +33,8 @@ export const useInitializeSocket: IUseInitializeSocket = ({ socketUrl }) => {

if (token) {
socketRef.current = io(socketUrl, {
reconnectionDelayMax: 10000,
reconnectionDelayMax: RECONNECTION_DELAY_MAX,
randomizationFactor: RANDOMIZATION_FACTOR,
transports: ['websocket'],
auth: {
token: `${token}`,
Expand Down

0 comments on commit e8477dc

Please sign in to comment.