{"id":45906091,"url":"https://github.com/rohittiwari-dev/ocpp-ws-io","last_synced_at":"2026-04-01T18:33:28.400Z","repository":{"id":340220768,"uuid":"1159680774","full_name":"rohittiwari-dev/ocpp-ws-io","owner":"rohittiwari-dev","description":"Type-safe OCPP WebSocket RPC client \u0026 server with pub/sub, session management, and clustering support","archived":false,"fork":false,"pushed_at":"2026-03-27T21:52:33.000Z","size":3842,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-27T22:54:24.960Z","etag":null,"topics":["central","dev-tools","e-mobility","emobility","ocpp","ocpp-central","ocpp-rpc","ocpp-rpc-ts","ocpp-server","ocpp-ws-client","ocpp16","ocpp16j","ocpp20","ocpp201","ocpp21","ocppwebsocket","websocket","websocket-ocpp","websocket-server","websockets"],"latest_commit_sha":null,"homepage":"https://ocpp-ws-io.rohittiwari.me","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rohittiwari-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["rohittiwari-dev"]}},"created_at":"2026-02-17T02:57:19.000Z","updated_at":"2026-03-27T21:51:50.000Z","dependencies_parsed_at":"2026-03-08T20:03:01.421Z","dependency_job_id":null,"html_url":"https://github.com/rohittiwari-dev/ocpp-ws-io","commit_stats":null,"previous_names":["rohittiwari-dev/ocpp-ws-io"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/rohittiwari-dev/ocpp-ws-io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittiwari-dev%2Focpp-ws-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittiwari-dev%2Focpp-ws-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittiwari-dev%2Focpp-ws-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittiwari-dev%2Focpp-ws-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohittiwari-dev","download_url":"https://codeload.github.com/rohittiwari-dev/ocpp-ws-io/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohittiwari-dev%2Focpp-ws-io/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["central","dev-tools","e-mobility","emobility","ocpp","ocpp-central","ocpp-rpc","ocpp-rpc-ts","ocpp-server","ocpp-ws-client","ocpp16","ocpp16j","ocpp20","ocpp201","ocpp21","ocppwebsocket","websocket","websocket-ocpp","websocket-server","websockets"],"created_at":"2026-02-28T02:57:31.571Z","updated_at":"2026-04-01T18:33:28.393Z","avatar_url":"https://github.com/rohittiwari-dev.png","language":"TypeScript","funding_links":["https://github.com/sponsors/rohittiwari-dev"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/rohittiwari-dev/ocpp-ws-io/main/assets/banner.svg\" alt=\"ocpp-ws-io ecosystem\" width=\"420\" /\u003e\n\u003c/p\u003e\n\n**The Complete, Type-Safe OCPP Ecosystem for Node.js**\n\nA 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. \n\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE)\n[![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen?style=flat-square\u0026logo=node.js)](https://nodejs.org)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-3178C6?style=flat-square\u0026logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org)\n\n[Documentation](https://ocpp-ws-io.rohittiwari.me) · [npm Organization / Core Package](https://www.npmjs.com/package/ocpp-ws-io) · [Contributing](CONTRIBUTING.md)\n\n\u003c/div\u003e\n\n---\n\n## 🌍 Why Does This Ecosystem Exist?\n\nHistorically, 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.\n\n**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 \u0026 Web Simulator toolset.\n\n### The Packages at a Glance\n\n| Package | Description | Status |\n|---------|-------------|--------|\n| [**`ocpp-ws-io`**](packages/ocpp-ws-io) | **Core WebSocket RPC client \u0026 server.** Call framing, Type Safety, Security Profiles, DDoS protection, Redis clustering. | [![npm](https://img.shields.io/npm/v/ocpp-ws-io.svg?style=flat-square\u0026color=cb3837)](https://www.npmjs.com/package/ocpp-ws-io) |\n| [**`ocpp-smart-charge-engine`**](packages/ocpp-smart-charge-engine) | **Library-agnostic load balancing.** Distributes grid power safely among EVs using advanced mathematical constraint solvers. | [![npm](https://img.shields.io/npm/v/ocpp-smart-charge-engine.svg?style=flat-square\u0026color=cb3837)](https://www.npmjs.com/package/ocpp-smart-charge-engine) |\n| [**`ocpp-protocol-proxy`**](packages/ocpp-protocol-proxy) | **Version translation proxy.** Translates OCPP versions seamlessly (e.g., 1.6 ↔ 2.1) without touching charger firmware. | [![npm](https://img.shields.io/npm/v/ocpp-protocol-proxy.svg?style=flat-square\u0026color=cb3837)](https://www.npmjs.com/package/ocpp-protocol-proxy) |\n| [**`ocpp-ws-cli`**](packages/cli) | **Terminal tooling ecosystem.** Code generation, CLI Simulation, Distributed Load Testing, Fuzzing, and Cert Generation. | [![npm](https://img.shields.io/npm/v/ocpp-ws-cli.svg?style=flat-square\u0026color=cb3837)](https://www.npmjs.com/package/ocpp-ws-cli) |\n| [**`ocpp-ws-simulator`**](https://ocpp.rohittiwari.me) | **Visual Web UI Simulator.** A full-featured Next.js browser-based charge point emulator. Live at [ocpp.rohittiwari.me](https://ocpp.rohittiwari.me). | ✅ Available |\n| [**`voltlog-io`**](https://npmjs.com/package/voltlog-io) | **Structured Logger.** High-performance structured logging layer powering the ecosystem's network diagnostics. | ✅ Published |\n\n---\n\n## ⚡ 1. Core RPC: `ocpp-ws-io`\n\nAt the heart of the ecosystem is the rock-solid WebSocket RPC core. \n\n**Features:**\n- **End-to-End Type Safety**: Auto-generated typings for all 1.6, 2.0.1, and 2.1 methods.\n- **Security Profiles 0–3**: Plain WS, Basic Auth, TLS + Basic Auth, Mutual TLS (mTLS).\n- **Resilience**: Redis caching, eager state-synchronization, token-bucket Rate Limiting per station, and single-source-of-truth idempotency keys.\n\n**Example: Spinning up a Central System (Server)**\n```typescript\nimport { OCPPServer } from \"ocpp-ws-io\";\n\nconst server = new OCPPServer({\n  protocols: [\"ocpp1.6\", \"ocpp2.0.1\"],\n  logging: { prettify: true, exchangeLog: true }, // Watch the network traffic!\n});\n\n// Authenticate incoming connection\nserver.auth((ctx) =\u003e {\n  ctx.accept({ session: { authorized: true } });\n});\n\n// Handle incoming messages gracefully\nserver.on(\"client\", (client) =\u003e {\n  client.handle(\"ocpp1.6\", \"BootNotification\", ({ params }) =\u003e {\n    return {\n      status: \"Accepted\",\n      currentTime: new Date().toISOString(),\n      interval: 300,\n    };\n  });\n});\n\nawait server.listen(3000);\n```\n\n---\n\n## ⚡ 2. Protocol Translation: `ocpp-protocol-proxy`\n\nLegacy 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.\n\n**Features:**\n- **Any-to-Any Translation**: Maps all 28 messages of OCPP 1.6 to 2.1 bidirectionally.\n- **Middleware Hooks**: Intercept messages pre- and post-translation for observability.\n- **Stateful Sessions**: Automatically maps string-based UUIDs (2.1) to integer Transaction IDs (1.6).\n\n**Example: Translating 1.6 to 2.1**\n```typescript\nimport { OCPPProtocolProxy, presets, OcppWsIoAdapter } from \"ocpp-protocol-proxy\";\n\n// Connect to upstream CSMS running OCPP 2.1\nconst proxy = new OCPPProtocolProxy({\n  upstreamEndpoint: \"ws://your-modern-csms:9000\",\n  upstreamProtocol: \"ocpp2.1\",\n});\n\n// Load the 1.6 → 2.1 translation mappings\nproxy.translate(presets.ocpp16_to_ocpp21);\n\n// Accept connections from legacy 1.6 EVs\nconst adapter = new OcppWsIoAdapter({\n  port: 9001,\n  protocols: [\"ocpp1.6\"],\n});\n\nawait proxy.listenOnAdapter(adapter);\n```\n\n---\n\n## ⚡ 3. Load Balancing: `ocpp-smart-charge-engine`\n\nHow do you safely distribute 100kW of physical grid power across 5 cars without tripping the breaker? Use the Smart Charge Engine.\n\n**Features:**\n- **Multiple Algorithms**: Equal Share, Priority, Time-of-Use.\n- **Auto-Dispatch**: Recalculates mathematically optimal charging limits on an interval.\n- **Hardware Agnostic**: Handles minimum EV acceptance floors and maximum hardware limits to prevent faults.\n\n**Example: Distributing Power**\n```typescript\nimport { SmartChargingEngine, Strategies } from \"ocpp-smart-charge-engine\";\nimport { buildOcpp16Profile } from \"ocpp-smart-charge-engine/builders\";\n\nconst engine = new SmartChargingEngine({\n  siteId: \"SITE-001\",\n  maxGridPowerKw: 100, // 100kW max capacity\n  safetyMarginPct: 5,  // Never use more than 95% of grid limit\n  algorithm: Strategies.EQUAL_SHARE,\n  \n  // The integration point—simply send what the engine calculates!\n  dispatcher: async ({ clientId, connectorId, sessionProfile }) =\u003e {\n    await server.safeSendToClient(clientId, \"ocpp1.6\", \"SetChargingProfile\", {\n      connectorId,\n      csChargingProfiles: buildOcpp16Profile(sessionProfile),\n    });\n  },\n});\n\n// A car connects\nengine.addSession({\n  transactionId: 1,\n  clientId: \"CP001\",\n  minChargeRateKw: 1.4, // Keep car awake\n});\n\n// Recalculates limits across all active cars and fires the dispatcher\nawait engine.dispatch(); \n```\n\n---\n\n## ⚡ 4. Testing \u0026 Simulators: `ocpp-ws-cli` \u0026 Web UI\n\nTesting physical chargers is expensive. We built tools to let you test immediately in software.\n\n### Terminal Tooling (`ocpp-ws-cli`)\n\n**Features:**\n- **`ocpp simulate`**: Interactive terminal-based Virtual Charge Point. Swipe RFID tags, start transactions, and stream metrics with keyboard shortcuts.\n- **`ocpp load-test`**: Simulate 1000s of concurrent EVs slamming your CSMS.\n- **`ocpp bench`**: Print throughput metrics and latency percentiles (P95, P99).\n- **`ocpp fuzz`**: Chaos engineer your CSMS by hurling malformed JSON payloads at it.\n\n**Example:**\n```bash\n# Install globally\nnpm i -g ocpp-ws-cli\n\n# Start an interactive CLI Simulator\nocpp simulate\n```\n\n### Web Simulator (`ocpp-ws-simulator`)\n\nFor visual debugging and demos, we maintain an entire Next.js browser-based simulator. \n\n**🌍 Live application**: [**ocpp.rohittiwari.me**](https://ocpp.rohittiwari.me)\n\nYou can also launch it locally directly from the CLI tool:\n\n```bash\n# Clones the repo, installs dependencies, and boots the Next.js visual simulator!\nocpp studio\n```\n\nOr grab the source directly: [github.com/rohittiwari-dev/ocpp-ws-simulator](https://github.com/rohittiwari-dev/ocpp-ws-simulator)\n\n---\n\n## 📚 General Ecosystem Documentation\n\nExplore the comprehensive documentation for the entire ecosystem:\n- [Official Documentation Portal](https://ocpp-ws-io.rohittiwari.me)\n- [API Reference](https://ocpp-ws-io.rohittiwari.me/docs/api-reference)\n\n## 🐳 Requirements\n\n- **Node.js** ≥ 18.0.0\n- **TypeScript** ≥ 5.0 (optional, but highly recommended)\n\n## ❤️ Contributing\n\nWe welcome contributions across all packages in the ecosystem! This repository is organized as a Turborepo monorepo.\n\nPlease see our [Contributing Guide](CONTRIBUTING.md) for details on:\n- Setting up the development environment (`npm install \u0026\u0026 npm run build`)\n- Submitting pull requests\n- Code style and commit conventions (we use `changesets` and `commitlint`)\n\nPlease read our [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.\n\n## 🛡️ Security\n\nTo report a security vulnerability in any of our packages, please see our [Security Policy](SECURITY.md).\n\n## 📄 License\n\n[MIT](LICENSE) © 2026 Rohit Tiwari\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohittiwari-dev%2Focpp-ws-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohittiwari-dev%2Focpp-ws-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohittiwari-dev%2Focpp-ws-io/lists"}