Home / Type/ HotChannel Type — vite Architecture

HotChannel Type — vite Architecture

Architecture documentation for the HotChannel type/interface in hmr.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  b9249f02_7ab1_8907_13f7_3ec989e69e19["HotChannel"]
  18db4f26_79f1_5b7d_b291_4feeaf95538f["hmr.ts"]
  b9249f02_7ab1_8907_13f7_3ec989e69e19 -->|defined in| 18db4f26_79f1_5b7d_b291_4feeaf95538f
  style b9249f02_7ab1_8907_13f7_3ec989e69e19 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/server/hmr.ts lines 86–110

export interface HotChannel<Api = any> {
  /**
   * Broadcast events to all clients
   */
  send?(payload: HotPayload): void
  /**
   * Handle custom event emitted by `import.meta.hot.send`
   */
  on?<T extends string>(event: T, listener: HotChannelListener<T>): void
  on?(event: 'connection', listener: () => void): void
  /**
   * Unregister event listener
   */
  off?(event: string, listener: Function): void
  /**
   * Start listening for messages
   */
  listen?(): void
  /**
   * Disconnect all clients, called when server is closed or restarted.
   */
  close?(): Promise<unknown> | void

  api?: Api
}

Frequently Asked Questions

What is the HotChannel type?
HotChannel is a type/interface in the vite codebase, defined in packages/vite/src/node/server/hmr.ts.
Where is HotChannel defined?
HotChannel is defined in packages/vite/src/node/server/hmr.ts at line 86.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free