No description
Find a file
autocommit d75066f67f
Some checks failed
Build and Publish / build-and-publish (push) Failing after 25s
Test / test (push) Failing after 1m2s
chore(deployment): 🔧 Update network location references from forge.black.local to forge.black.lan in deployment scripts and documentation
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-06-10 04:53:05 -07:00
.forgejo/workflows fix(ci): rewrite workflow with transform step and proper registry config 2026-01-30 15:51:40 -08:00
client deps-upgrade(deps): ⬆️ Update dependencies across client, core, and server packages 2026-06-10 04:53:05 -07:00
core deps-upgrade(deps): ⬆️ Update dependencies across client, core, and server packages 2026-06-10 04:53:05 -07:00
server deps-upgrade(deps): ⬆️ Update dependencies across client, core, and server packages 2026-06-10 04:53:05 -07:00
.gitignore feat: create websocket monorepo with separate packages 2026-01-22 16:12:22 -08:00
cleanup-old-locations.sh chore(deployment): 🔧 Update network location references from forge.black.local to forge.black.lan in deployment scripts and documentation 2026-06-10 04:53:05 -07:00
CLEANUP.md chore(deployment): 🔧 Update network location references from forge.black.local to forge.black.lan in deployment scripts and documentation 2026-06-10 04:53:05 -07:00
MIGRATION.md docs: add migration guide and cleanup plan 2026-01-22 16:13:47 -08:00
package.json deps-upgrade(dependencies): ⬆️ Update dependency versions in package.json and regenerate pnpm-lock.yaml 2026-01-29 08:32:41 -08:00
README.md chore(deployment): 🔧 Update network location references from forge.black.local to forge.black.lan in deployment scripts and documentation 2026-06-10 04:53:05 -07:00

@lilith/websocket

WebSocket client/server abstractions for Lilith Platform.

Packages

This monorepo contains three published packages:

@lilith/websocket-core

Shared types, interfaces, and event contracts used by both client and server.

Install: pnpm add @lilith/websocket-core

@lilith/websocket-client

React hooks and utilities for Socket.IO client connections.

Install: pnpm add @lilith/websocket-client

Features:

  • Shared namespace connection management
  • Auto-reconnection with exponential backoff
  • JWT authentication
  • TypeScript event contracts

@lilith/websocket-server

NestJS WebSocket gateway base classes and utilities.

Install: pnpm add @lilith/websocket-server

Features:

  • BaseGateway abstract class (lifecycle, auth, broadcasting)
  • Client metadata tracking
  • Rate limiting per-client, per-event
  • JWT token extraction

Development

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Watch mode (all packages in parallel)
pnpm dev

# Type checking
pnpm typecheck

# Run tests
pnpm test

Publishing

Each package publishes independently to forge.black.lan:

# From package directory
cd core && pnpm publish
cd client && pnpm publish
cd server && pnpm publish

Or use CI/CD workflow (recommended):

git push origin master  # Triggers publish.yml workflow
# Requires NPM_TOKEN secret configured in repository settings

Architecture

@websocket/
├── core/          → @lilith/websocket-core (types)
├── client/        → @lilith/websocket-client (React hooks)
└── server/        → @lilith/websocket-server (NestJS gateways)

Migration from Old Packages

Old locations (deprecated):

  • codebase/@packages/@infrastructure/websocket-client/
  • @packages/@ts/websocket/
  • @packages/@ts/websocket-server/

New imports:

// Core types
import type { HealthEvents, ClientMetadata } from '@lilith/websocket-core';

// Client hooks (React)
import { useNamespace } from '@lilith/websocket-client';

// Server gateway (NestJS)
import { BaseGateway } from '@lilith/websocket-server';