Skip to main content

Global Hooks

These hooks are available throughout the application (not specific to a single feature). They are located in hooks/.

Logic & State

useAuth

Exposes the current user session and methods to login/logout.

  • Returns: { user, isLoading, login, logout }

useSocketManager

Manages the global Socket.io connection pool.

  • Used to subscribe to real-time events.
  • Handles auto-reconnection and authentication.

useProtocolManager

The brain behind the Video Player.

  • Decides which protocol to use (MSE -> WebRTC -> HLS).
  • Handles fallback logic when a stream fails.

Video Streaming

useMse / useMseWebSocket

Implements the Media Source Extensions player over WebSocket.

  • Low latency (< 500ms).
  • Hardest on CPU.

useHls / useHlsll

Wrapper around hls.js for HLS playback.

  • useHls: Standard latency.
  • useHlsll: Low Latency configuration.

UI / Feedback

useToast

Displays toast notifications (Success, Error, Info). Powered by shadcn/ui.

useNotifications

Manages the user's notification capability (Browser Permissions for Push Notifications).