Skip to main content
Back to plugins
@capgo/capacitor-live-reload
Tutorial
by github.com/Cap-go

Live Reload

Connect to your dev server for instant hot reloading during development

Guide

Tutorial on Live Reload

Using @capgo/capacitor-live-reload

Capacitor plugin to live reload Capacitor apps from a remote Vite dev server.

Install

bun add @capgo/capacitor-live-reload
bunx cap sync

What This Plugin Exposes

  • configureServer - Store remote dev server settings used for subsequent connections.
  • connect - Establish a WebSocket connection if one is not already active.
  • disconnect - Close the current WebSocket connection and disable auto reconnect.
  • getStatus - Returns the current connection status.

Example Usage

configureServer

Store remote dev server settings used for subsequent connections.

import { LiveReload } from '@capgo/capacitor-live-reload';

await LiveReload.configureServer({} as ConfigureServerOptions);

connect

Establish a WebSocket connection if one is not already active.

import { LiveReload } from '@capgo/capacitor-live-reload';

await LiveReload.connect();

disconnect

Close the current WebSocket connection and disable auto reconnect.

import { LiveReload } from '@capgo/capacitor-live-reload';

await LiveReload.disconnect();

getStatus

Returns the current connection status.

import { LiveReload } from '@capgo/capacitor-live-reload';

await LiveReload.getStatus();

Full Reference