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

SparkPlugB 3.0 Specification primary host STATE message Payload and Topic #68

Open
shouidar opened this issue Feb 10, 2024 · 5 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@shouidar
Copy link
Contributor

Just wanted to share some of my findings while trying to implement a Primary Host compliant with 3.0 Specification:

  1. In the current version of the code The payload returned by GetSparkPlugStateMessage defaults to UtcNow, while in the 3.0 Specification, The application may need to send different timestamp in the State message mainly when republishing the Primary Host BIRTH message:
private static string GetSparkplugStateMessage(bool online)
    {
        return JsonSerializer.Serialize(new StateMessage
        {
            Online = online,
            Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
        });
    }
  1. The sparkPlugB topic for the WILL/DEATH/BIRTH state message should be spBv1.0/STATE/Host_Id instead of STATE/Host_Id
  2. Should the current version of the library maintain backward compatibility with previous SparkPlug B specification (1.2.1 and below) as an option?
@SeppPenner SeppPenner self-assigned this Feb 10, 2024
@SeppPenner SeppPenner added bug Something isn't working enhancement New feature or request labels Feb 10, 2024
@SeppPenner
Copy link
Owner

  1. I need to check this.
  2. Ok, need to check this as well.
  3. I honestly would avoid this unless someone really needs it...

@shouidar
Copy link
Contributor Author

For (3) I actually meant Spec version 2.2 and below.
The current implementation of GetSparkplugStateMessageB returns the STATE payload in JSON format as specified in 3.0. This breaks compatibility with 2.2 and below which uses UTF8 string "ONLINE" or "OFLINE" for STATE message in addition the state topics being different.

@SeppPenner
Copy link
Owner

For (3) I actually meant Spec version 2.2 and below. The current implementation of GetSparkplugStateMessageB returns the STATE payload in JSON format as specified in 3.0. This breaks compatibility with 2.2 and below which uses UTF8 string "ONLINE" or "OFLINE" for STATE message in addition the state topics being different.

I will include this soon. Seems like a legit thing to do so. Especially, as it's not a big thing as only the state message has changed (For now).

@SeppPenner
Copy link
Owner

Issue 3 is done, 1 and 2 need still to be checked.

@SeppPenner SeppPenner reopened this Feb 20, 2024
@SeppPenner
Copy link
Owner

2 and 3 are done, need to check 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants