Skip to content

Support for Dynamic WebSocket Path Routing (e.g. /{organization}/{chargepoint}) #364

@dwlpra

Description

@dwlpra

❔ What is your question?

Hi, thank you for this great library.
I’m building a multi-tenant CSMS using ocpp-go, and I need to support WebSocket URLs with dynamic routing patterns, like:
ws://localhost:8887/{organization_code}/{chargeBoxIdentity}

For example:
ws://localhost:8887/acme-corp/cs-01

In this setup:

  • acme-corp is the tenant/organization code
  • cs-01 is the ChargeBoxIdentity (endpoint)

Currently, the csms.Start(port, path) function accepts only a static path (e.g. /ws), and connections outside this path are not handled by the central system.

❓ Question:

Is there a way to override or extend the path handling logic to support dynamic paths like /{org}/{id}?

🔧 What I've tried:

I attempted to use http.HandleFunc("/", customHandler) and manually upgrade the connection, but it seems ocpp-go uses its own internal WebSocket handling via the ws package.

🧩 Ideal solution:

Expose a way to:

  • Intercept or route based on the full URL path
  • Extract custom routing parameters (org, id)
  • Still pass the connection to central.NewCentralSystem() properly

Is this currently supported? If not, would you accept a contribution/PR that allows pluggable path handling or routing logic?

Thank you in advance!

Which OCPP version referring to?

  • OCPP 1.6
  • OCPP 2.0.1

Are you using any OCPP extensions?

  • OCPP 1.6 Security
  • OCPP 1.6 Plug and Charge

👀 Have you spent some time to check if this question has been asked before?

  • I checked and didn't find a similar issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions