UNPKG

react-query-external-sync

Version:

A tool for syncing React Query state to an external Dev Tools

39 lines (38 loc) 1.32 kB
import { Socket } from 'socket.io-client'; import { PlatformOS } from './platformUtils'; interface Props { deviceName: string; socketURL: string; persistentDeviceId: string | null; extraDeviceInfo?: Record<string, string>; envVariables?: Record<string, string>; platform: PlatformOS; /** * Enable/disable logging for debugging purposes * @default false */ enableLogs?: boolean; /** * Whether the app is running on a physical device or an emulator/simulator * This can affect how the socket URL is constructed, especially on Android * @default false */ isDevice?: boolean; } /** * Hook that handles socket connection for device-dashboard communication * * Features: * - Singleton pattern for socket connection * - Platform-specific URL handling for iOS/Android/Web * - Device name identification * - Connection state tracking * - User list management */ export declare function useMySocket({ deviceName, socketURL, persistentDeviceId, extraDeviceInfo, envVariables, platform, enableLogs, isDevice }: Props): { socket: Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>; connect: () => void; disconnect: () => void; isConnected: boolean; }; export {};