Skip to content

Test a Local CSMS: Connect the Simulator to ws://localhost

Connect a browser OCPP simulator to a CSMS on your machine: allow insecure WebSockets from HTTPS, test reachability, or use an ngrok or Cloudflare tunnel.

Why the browser blocks localhost

The hosted simulator runs on HTTPS. A page loaded over HTTPS may not open an unencrypted ws:// connection — browsers treat it as mixed content — and recent Chrome versions also ask before a public site can reach devices on your local network. Your CSMS at ws://localhost:9000 is both, so the connection is refused until you allow it.

Option 1: allow insecure content (fastest)

Chrome, Edge and Brave:

  1. Click the site information icon at the left of the address bar, then Site settings.
  2. Set Insecure content to Allow. If Local network access is listed, allow it too.
  3. Reload the simulator and connect.

Firefox: open about:config, accept the warning, set network.websocket.allowInsecureFromHTTPS to true and reload.

Option 2: run the simulator locally

Served from http://localhost, the simulator can reach any local port with no browser changes:

Terminal
git clone https://github.com/rohittiwari-dev/ocpp-ws-simulator.git
cd ocpp-ws-simulator
npm install
npm run dev

Then open http://localhost:3000. If your CSMS also uses port 3000, run the simulator on another port with npm run dev -- -p 3100.

Option 3: expose your CSMS with a tunnel

A tunnel gives your local server a public wss:// address, which HTTPS pages may always use:

Terminal
# ngrok
ngrok http 9000
# → use wss://<your-subdomain>.ngrok-free.app as the CSMS URL

# or Cloudflare Tunnel
cloudflared tunnel --url http://localhost:9000

Replace https:// with wss:// in the address the tunnel prints.

Check the connection

The simulator header has a Localhost guide with a built-in reachability test: enter your port, run the WebSocket test and it tells you whether the connection succeeded, was blocked by the browser or was refused — and applies the URL to your charger in one click.

Connect to your local CSMS

Open the simulator, keep ws://localhost:9000 and select Connect.

Open the simulator

Frequently asked questions

Why can't the simulator connect to ws://localhost?

When the simulator is opened over HTTPS, browsers block unencrypted ws:// connections from it as mixed content, and newer Chrome versions also ask before a site can reach devices on your local network. Allow insecure content for the site, run the simulator locally, or use a wss:// tunnel.

Do I need a tunnel to test locally?

No. Allowing insecure content for the simulator site, or running the simulator itself on localhost, both work without a tunnel. A tunnel is useful when browser settings can't be changed, for example on a managed work machine.

How do I check that my CSMS is reachable?

Open the Localhost guide from the simulator header, go to Test and run the WebSocket test against your port. It reports whether the connection succeeded, was blocked by the browser or was refused, with the round-trip time.