@scipen/ot-adapter-electron-main
v0.1.0
Published
Electron main-process adapter for Scipen OT core
Readme
@scipen/ot-adapter-electron-main
Electron main process adapter for @scipen/ot-core, providing HTTP (via Node fetch) and WebSocket (via ws) implementations.
Install
pnpm add @scipen/ot-core @scipen/ot-adapter-electron-main wsNote: ws is a peer dependency — declare it explicitly in the consuming app's package.json.
Usage
import { OTCore } from '@scipen/ot-core';
import {
createElectronMainOTAdapter,
type WebSocketConstructor,
} from '@scipen/ot-adapter-electron-main';
import WebSocket from 'ws';
const client = new OTCore(
{ baseUrl: 'https://api.example.com/ot', token: 'xxx', userId: 'u1' },
createElectronMainOTAdapter(WebSocket as unknown as WebSocketConstructor)
);baseUrl must be an absolute URL (no window.location fallback available in Node).
Dependency graph
@scipen/ot-protocol + @scipen/ot-core
↓
@scipen/ot-adapter-electron-main (this package, Node-only)License
MIT © SciPen Team
