Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to properly handle TriggerMessage flow? #52

Open
ic-768 opened this issue May 29, 2024 · 0 comments
Open

How to properly handle TriggerMessage flow? #52

ic-768 opened this issue May 29, 2024 · 0 comments

Comments

@ic-768
Copy link

ic-768 commented May 29, 2024

I create a charge point like so:

export const cpHandlers: RequestHandler<
  CentralSystemAction<"v1.6-json">,
  ValidationError | undefined,
  "v1.6-json"
> = (req) => {
  switch (req.action) {
    case "TriggerMessage":
      return {
        status: "Accepted",
        action: "TriggerMessage",
        ocppVersion: req.ocppVersion,
      };
  }
  throw new Error("message not supported");
};


export const cp = new ChargePoint(
  chargerId,
  cpHandlers,
  `${wsUrl}/${chargerId}`

According to the specs, immediately after confirming TriggerMessage, I need to send the message being triggered.
What is the intended way to do this?

I can't seem to find a way to guarantee that it will be sent AFTER returning the confirmation for TriggerMessage.
I thought about adding a setTimeOut with the requested message before returning the confirmation, but it seems wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant