GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - rohittiwari-dev/ocpp-ws-io: Type-safe OCPP WebSocket RPC client & server with pub/sub, session management, and clustering support

BranchesTags
Open more actions menu

Latest commit

 

History

390 Commits
390 Commits

Folders and files

NameName
Last commit message
Last commit date
.changeset
.changeset
 
 
.github
.github
 
 
.husky
.husky
 
 
.vscode
.vscode
 
 
apps
apps
 
 
assets
assets
 
 
packages
packages
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
biome.json
biome.json
 
 
bun.lock
bun.lock
 
 
bunfig.toml
bunfig.toml
 
 
commitlint.config.js
commitlint.config.js
 
 
modular-usage.ts
modular-usage.ts
 
 
package.json
package.json
 
 
single-usage.ts
single-usage.ts
 
 
tsconfig.json
tsconfig.json
 
 
turbo.json
turbo.json
 
 

Repository files navigation

ocpp-ws-io ecosystem

The Complete, Type-Safe OCPP Ecosystem for Node.js

A modular suite of tools built with TypeScript from the ground up for building Charge Point Management Systems (CSMS), Charge Point Simulators (EVSE), Smart Charging Solvers, and Protocol Translators.

License: MIT Node.js TypeScript

Documentation · npm Organization / Core Package · Contributing


⚠️ Netlify Status: Due to high traffic, documentation loading may experience delays under free tier. I appreciate your patience!


🌍 Why Does This Ecosystem Exist?

Historically, building an OCPP-compliant network has been an infrastructure nightmare. Moving from OCPP 1.6 to modern standards like OCPP 2.0.1 or 2.1 traditionally required structural backend rewrites. You were forced to manually write WebSocket framing, connection backoff logic, rate limiting, and state persistence. Smart Charging (distributing finite grid power) required you to invent complex mathematical constraint solvers. And testing? That meant either setting up physical hardware or running clunky, unmaintained Java desktop simulators.

The Solution: ocpp-ws-io is a modern, modular ecosystem that solves these problems. It provides end-to-end type safety, plug-and-play architectural components (RPC Core, Security, Proxies, Smart Charging), and a lightning-fast CLI & Web Simulator toolset.

The Packages at a Glance

From 3.1.0 (on npm's beta tag until it is released: npm install ocpp-ws-io), the protocol proxy, the smart charge engine and the CLI ship in ocpp-ws-io. Their old packages, ocpp-protocol-proxy, ocpp-smart-charge-engine and ocpp-ws-cli, are deprecated: their last releases only re-export or run ocpp-ws-io.

Package Description Status
ocpp-ws-io Core WebSocket RPC client & server. Call framing, Type Safety, Security Profiles, DDoS protection, Redis clustering. npm
ocpp-ws-io/smart-charge Library-agnostic load balancing. Distributes grid power safely among EVs using advanced mathematical constraint solvers. Formerly ocpp-smart-charge-engine. In ocpp-ws-io 3.1.0 (beta)
ocpp-ws-io/proxy Version translation proxy. Translates OCPP versions seamlessly (e.g., 1.6 ↔ 2.1) without touching charger firmware. Formerly ocpp-protocol-proxy. In ocpp-ws-io 3.1.0 (beta)
ocpp CLI Terminal tooling ecosystem. Code generation, CLI Simulation, Distributed Load Testing, Fuzzing, and Cert Generation. Formerly ocpp-ws-cli. In ocpp-ws-io 3.1.0 (beta)
ocpp-ws-simulator Visual Web UI Simulator. A full-featured Next.js browser-based charge point emulator. Live at ocpp.rohittiwari.me. ✅ Available
voltlog-io Structured Logger. High-performance structured logging layer powering the ecosystem's network diagnostics. ✅ Published

⚡ 1. Core RPC: ocpp-ws-io

At the heart of the ecosystem is the rock-solid WebSocket RPC core.

Features:

  • End-to-End Type Safety: Auto-generated typings for all 1.6, 2.0.1, and 2.1 methods.
  • Security Profiles 0–3: Plain WS, Basic Auth, TLS + Basic Auth, Mutual TLS (mTLS).
  • Resilience: Redis caching, eager state-synchronization, token-bucket Rate Limiting per station, and single-source-of-truth idempotency keys.

Example: Spinning up a Central System (Server)

import { OCPPServer } from "ocpp-ws-io";

const server = new OCPPServer({
  protocols: ["ocpp1.6", "ocpp2.0.1"],
  logging: { prettify: true, exchangeLog: true }, // Watch the network traffic!
});

// Authenticate incoming connection
server.auth((ctx) => {
  ctx.accept({ session: { authorized: true } });
});

// Handle incoming messages gracefully
server.on("client", (client) => {
  client.handle("ocpp1.6", "BootNotification", ({ params }) => {
    return {
      status: "Accepted",
      currentTime: new Date().toISOString(),
      interval: 300,
    };
  });
});

await server.listen(3000);

⚡ 2. Protocol Translation: ocpp-ws-io/proxy

Legacy OCPP 1.6 charge points can't natively speak to modern OCPP 2.1 central systems. Instead of maintaining dual-protocol backends, put the Protocol Proxy in between.

Features:

  • Any-to-Any Translation: Maps all 28 messages of OCPP 1.6 to 2.1 bidirectionally.
  • Middleware Hooks: Intercept messages pre- and post-translation for observability.
  • Stateful Sessions: Automatically maps string-based UUIDs (2.1) to integer Transaction IDs (1.6).

Example: Translating 1.6 to 2.1

import { OCPPProtocolProxy, presets, OcppWsIoAdapter } from "ocpp-ws-io/proxy";

// Connect to upstream CSMS running OCPP 2.1
const proxy = new OCPPProtocolProxy({
  upstreamEndpoint: "ws://your-modern-csms:9000",
  upstreamProtocol: "ocpp2.1",
});

// Load the 1.6 → 2.1 translation mappings
proxy.translate(presets.ocpp16_to_ocpp21);

// Accept connections from legacy 1.6 EVs
const adapter = new OcppWsIoAdapter({
  port: 9001,
  protocols: ["ocpp1.6"],
});

await proxy.listenOnAdapter(adapter);

⚡ 3. Load Balancing: ocpp-ws-io/smart-charge

How do you safely distribute 100kW of physical grid power across 5 cars without tripping the breaker? Use the Smart Charge Engine.

Features:

  • Multiple Algorithms: Equal Share, Priority, Time-of-Use.
  • Auto-Dispatch: Recalculates mathematically optimal charging limits on an interval.
  • Hardware Agnostic: Handles minimum EV acceptance floors and maximum hardware limits to prevent faults.

Example: Distributing Power

import { SmartChargingEngine, Strategies } from "ocpp-ws-io/smart-charge";
import { buildOcpp16Profile } from "ocpp-ws-io/smart-charge/builders";

const engine = new SmartChargingEngine({
  siteId: "SITE-001",
  maxGridPowerKw: 100, // 100kW max capacity
  safetyMarginPct: 5,  // Never use more than 95% of grid limit
  algorithm: Strategies.EQUAL_SHARE,
  
  // The integration point—simply send what the engine calculates!
  dispatcher: async ({ clientId, connectorId, sessionProfile }) => {
    await server.safeSendToClient(clientId, "ocpp1.6", "SetChargingProfile", {
      connectorId,
      csChargingProfiles: buildOcpp16Profile(sessionProfile),
    });
  },
});

// A car connects
engine.addSession({
  transactionId: 1,
  clientId: "CP001",
  minChargeRateKw: 1.4, // Keep car awake
});

// Recalculates limits across all active cars and fires the dispatcher
await engine.dispatch(); 

⚡ 4. Testing & Simulators: the ocpp CLI & Web UI

Testing physical chargers is expensive. We built tools to let you test immediately in software.

Terminal Tooling (the ocpp command of ocpp-ws-io)

Features:

  • ocpp simulate: Interactive terminal-based Virtual Charge Point. Swipe RFID tags, start transactions, and stream metrics with keyboard shortcuts.
  • ocpp load-test: Simulate 1000s of concurrent EVs slamming your CSMS.
  • ocpp bench: Print throughput metrics and latency percentiles (P95, P99).
  • ocpp fuzz: Chaos engineer your CSMS by hurling malformed JSON payloads at it.

Example:

# Install globally (or run once: npx ocpp-ws-io simulate)
npm i -g ocpp-ws-io

# Start an interactive CLI Simulator
ocpp simulate

Web Simulator (ocpp-ws-simulator)

For visual debugging and demos, we maintain an entire Next.js browser-based simulator.

🌍 Live application: ocpp.rohittiwari.me

You can also launch it locally directly from the CLI tool:

# Clones the repo, installs dependencies, and boots the Next.js visual simulator!
ocpp studio

Or grab the source directly: github.com/rohittiwari-dev/ocpp-ws-simulator


📚 General Ecosystem Documentation

Explore the comprehensive documentation for the entire ecosystem:

  • Official Documentation Portal
  • API Reference

🐳 Requirements

  • Node.js ≥ 18.0.0
  • TypeScript ≥ 5.0 (optional, but highly recommended)

❤️ Contributing

We welcome contributions across all packages in the ecosystem! This repository is organized as a Turborepo monorepo.

Please see our Contributing Guide for details on:

  • Setting up the development environment (npm install && npm run build)
  • Submitting pull requests
  • Code style and commit conventions (we use changesets and commitlint)

Please read our Code of Conduct before contributing.

🛡️ Security

To report a security vulnerability in any of our packages, please see our Security Policy.

📄 License

MIT © 2026 Rohit Tiwari

About

Type-safe OCPP WebSocket RPC client & server with pub/sub, session management, and clustering support

ocpp-ws-io.rohittiwari.me

Topics

centraldev-toolse-mobilityemobilityocppocpp-centralocpp-rpcocpp-rpc-tsocpp-serverocpp-ws-clientocpp16ocpp16jocpp20ocpp201ocpp21ocppwebsocketwebsocketwebsocket-ocppwebsocket-serverwebsockets

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

5 stars

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.