Getting Started
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-live-reload`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/live-reload/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Install
Section titled “Install”bun add @capgo/capacitor-live-reloadbunx cap syncImport
Section titled “Import”import { LiveReload } from '@capgo/capacitor-live-reload';API Overview
Section titled “API Overview”configureServer
Section titled “configureServer”Store remote dev server settings used for subsequent connections.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.configureServer({} as ConfigureServerOptions);connect
Section titled “connect”Establish a WebSocket connection if one is not already active.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.connect();disconnect
Section titled “disconnect”Close the current WebSocket connection and disable auto reconnect.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.disconnect();getStatus
Section titled “getStatus”Returns the current connection status.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.getStatus();reload
Section titled “reload”Trigger a full reload of the Capacitor WebView.
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reload();reloadFile
Section titled “reloadFile”Reload a single file/module if the runtime supports it (falls back to full reload).
import { LiveReload } from '@capgo/capacitor-live-reload';
await LiveReload.reloadFile({} as FileUpdatePayload);Type Reference
Section titled “Type Reference”ConfigureServerOptions
Section titled “ConfigureServerOptions”export interface ConfigureServerOptions { /** * Base URL for the dev server (e.g. https://dev.local:5173). * When a connection is established the Capacitor WebView navigates to this URL. */ url: string; /** Optional WebSocket path override when different from /ws. */ websocketPath?: string; /** Extra headers sent when creating the WebSocket connection. */ headers?: Record<string, string>; /** Automatically reconnect when the socket closes unexpectedly. Default: true. */ autoReconnect?: boolean; /** Delay (ms) between reconnection attempts. Default: 2000. */ reconnectInterval?: number;}LiveReloadStatus
Section titled “LiveReloadStatus”export interface LiveReloadStatus { connected: boolean; url?: string;}FileUpdatePayload
Section titled “FileUpdatePayload”export interface FileUpdatePayload { path: string; hash?: string;}LiveReloadEventCallback
Section titled “LiveReloadEventCallback”export type LiveReloadEventCallback = (event: LiveReloadEventPayload) => void;LiveReloadStatusCallback
Section titled “LiveReloadStatusCallback”export type LiveReloadStatusCallback = (status: LiveReloadStatus) => void;LiveReloadEventPayload
Section titled “LiveReloadEventPayload”export interface LiveReloadEventPayload { type: LiveReloadMessageType; /** Populated when type === 'file-update'. */ file?: FileUpdatePayload; /** Optional human-readable message for errors or status changes. */ message?: string;}LiveReloadMessageType
Section titled “LiveReloadMessageType”export type LiveReloadMessageType = 'full-reload' | 'file-update' | 'error' | 'connected' | 'disconnected';Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.