socket.io-react-hooks-advanced
Version:
A modular and extensible React + Socket.IO hook library designed for real-world applications. Supports namespaced sockets, reconnection strategies, offline queues, latency monitoring, middleware, encryption, and more.
26 lines (25 loc) • 785 B
TypeScript
import type { ReactNode } from "react";
import React from "react";
interface NamespacedSocketProviderProps {
url: string;
namespace?: string;
children: ReactNode;
getToken?: () => string | Promise<string>;
onUnauthorized?: () => Promise<string> | string;
maxRetries?: number;
initialDelayMs?: number;
maxDelayMs?: number;
backoffFactor?: number;
onRetry?: (attempt: number) => void;
onGiveUp?: () => void;
maxQueueSize?: number;
onQueueOverflow?: (event: any) => void;
persistQueue?: boolean;
queueKey?: string;
queueTTL?: number;
}
export declare const createNamespacedSocket: () => {
Provider: React.FC<NamespacedSocketProviderProps>;
useSocket: () => import("./SocketContext").SocketContextType;
};
export {};