v1.0.2 — OCPP 1.6 · 2.0.1 · 2.1

OCPP Connectivity
for Node.js

The type-safe, production-ready OCPP WebSocket RPC library for Node.js and the browser. Build EV charging infrastructure with full security profiles, schema validation, Redis clustering, and auto-generated TypeScript types.

$npm install ocpp-ws-io
server.ts
import { OCPPServer } from 'ocpp-ws-io';
const server = new OCPPServer({
protocols: ['ocpp1.6', 'ocpp2.0.1']
});
// Version-aware, fully typed
server.on('client', (client) => {
client.handle('BootNotification', ({ params }) => {
return {
status: 'Accepted',
currentTime: new Date().toISOString(),
interval: 300
}
})
});
await server.listen(3000);
Live Simulation

See it in Action

server-logs
[00:01]OCPP Server started on port 9220
[00:04]Client connected: CP_12345
[00:05]>> BootNotification ({ vendor: 'Tesla', model: 'v3' })
[00:06]<< BootNotificationConf ({ status: 'Accepted' })
[01:30]>> Heartbeat ()
[01:30]<< HeartbeatConf ({ currentTime: '...' })
[01:35]>> StatusNotification ({ status: 'Charging' })
CP_12345
Charge Point
OCPP Server
Node.js
Status: Connecting

One API, Three Environments

Write type-safe OCPP code for Node.js clients, servers, or browser-based charge point simulators — all with the same familiar API.

client.ts
import { OCPPClient } from 'ocpp-ws-io';
 
const client = new OCPPClient({
endpoint: 'ws://localhost:3000',
identity: 'CP001',
protocols: ['ocpp1.6'],
});
 
await client.connect();
 
// Version-aware, fully typed call
const res = await client.call('ocpp1.6', 'BootNotification', {
chargePointVendor: 'VendorX',
chargePointModel: 'ModelY',
});

Core Features

Built for reliability, correctness, and developer experience — everything you need for production OCPP infrastructure.

Type-Safe Everything

End-to-end TypeScript support with auto-generated types for every OCPP 1.6, 2.0.1, and 2.1 message. Request params and responses are fully inferred.

Security Profiles 0–3

Built-in support for all OCPP security profiles: plain WebSocket, Basic Auth, TLS + Basic Auth, and Mutual TLS with client certificates.

NoneBasic AuthTLSmTLS

High Performance

WebSocket engine optimized for concurrent connections with configurable call concurrency, timeouts, and queue management.

concurrent calls

Multi-Version Support

Unified typed API for OCPP 1.6, 2.0.1, and 2.1. Register version-specific or generic handlers — the protocol context is always available.

v1.6v2.0.1v2.1

Schema Validation

Strict mode validates all inbound and outbound messages against official OCPP JSON schemas. Custom validators supported.

BootNotification
Heartbeat
StatusNotification

Framework Agnostic

Use standalone, or attach to Express, Fastify, NestJS, or any HTTP server. Manual handleUpgrade available for full control.

StandaloneExpressFastifyNestJS

Redis Clustering

Optional Redis adapter for multi-instance deployments behind a load balancer. Works with both ioredis and node-redis.

1
2
3
→ Redis

Browser Client

Zero-dependency browser WebSocket client for building charge point simulators and testing dashboards. Same typed API, runs in React, Vue, or Next.js.

Minimal Dependencies

Lightweight architecture built on ws and cuid2. No heavy runtime dependencies — fast install, small bundle.

Latest from the Blog

Updates, guides, and technical deep dives.