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) • 814 B
TypeScript
import React from "react";
import { SocketContextType } from "./SocketContext";
import { QueuedEmit } from "../utils/storageQueue";
interface Props {
url: string;
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?: (dropped: QueuedEmit) => void;
children: React.ReactNode;
persistQueue?: boolean;
queueKey?: string;
queueTTL?: number;
namespace?: string;
contextOverride?: React.Context<SocketContextType>;
extraHeaders?: Record<string, any>;
}
export declare const SocketProvider: React.FC<Props>;
export {};