pluv.io is in preview! Please wait for a v1.0.0 stable release before using this in production.

Ecosystem

Below are some optional packages that work alongside pluv.

@pluv/addon-indexeddb

Use IndexedDB to persist room storage so that when the page is reloaded, the room will load from IndexedDB on the browser. This enables offline editing.

Installation

npm install @pluv/addon-indexeddb

Usage

// Using @pluv/client

import { addonIndexedDB } from "@pluv/addon-indexeddb";
import { createClient } from "@pluv/client";
import { type io } from "../server/io";

const client = createClient<typeof io>();

const room = client.createRoom("my-room", {
    // ... other configs here,
    // ...
    addons: [addonIndexedDB({ enabled: true })],
    // Alternatively
    addons: [addonIndexedDB({ enabled: (room) => room.id === "my-room" })],
});

// Using @pluv/react

import { addonIndexedDB } from "@pluv/addon-indexeddb";
import { createBundle, createClient } from "@pluv/react";

const client = createClient<typeof io>();

const { createRoomBundle } = createBundle(client);

const { useRoom } = createRoomBundle({
    // ... other configs here,
    // ...
    addons: [addonIndexedDB({ enabled: true })],
        // Alternatively
    addons: [addonIndexedDB({ enabled: (room) => room.id === "my-room" })],
});