-
Download Node.js. You can use
-
Goto root folder of repo (where packages.json file is present) and install required NPM packages with:
npm install
Open shell in root folder and start server
npm run start-server
Open shell in root folder and start server
npm run start-client
Attached Dockerfile demonstrates procedure for starting node application with docker. Important point is to install packages with node package manager (npm), copy source file over and then use custom scripts defined inside package.json to start node via npm.
Another approach can be used if you like.
- Servers accepts client conections and upgrades them to websocket protocol
- It responds to various OCPP messages
- Ocasionally it send PING / PONG to determine which clients are still alive
- When client connects with websocket, it sends boot notification.
- After response is recevied, it reads heartbeat interval from it
- it send heartbeat message according to interval
- CS_PROTOCOL defaults to ws. possible values are: ws, wss (for SSL)
- CS_HOST defaults to localhost. host to connect to
- CS_PORT defaults to 8080. port to connect to
- CONCURRENCY_LEVEL defaults to 1. Number of clients to create
- LOG_PAYLOAD verbose logging of data exchange between client and server
- LOG_LIFECYCLE = log lifecyle events (connect, reconnect, pingpong)
- WEB_SRV_HOST interface to bind to (could be only one)
- WEB_SRV_PORT port on bind interface
- HEARTBEAT_INT_MS interval in which we check client if its still connected
- LOG_PAYLOAD verbose logging of data exchange between client and server
- LOG_LIFECYCLE = log lifecyle events (connect, reconnect, pingpong)
node ocpp-central-cystem-server.js
node ocpp-chargepoint-client.js
- Install extension for debugging in chrome browser
Node.js V8 --inspector Manager (NiM]
- Start NiM extension in Chrome:
Open about://inspect in a new tab
- Start node script with inspect enabled.
node --inspect-brk ocpp-chargepoint-client.js
- After a few seconds you should see Target upgradeServer.js on your chrome tab. Click on inspect link and new DevTools window will appear with source code.