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

[feat] Add some kind of transaction id to API responses #278

Closed
LordMike opened this issue Jan 19, 2021 · 12 comments · Fixed by #281
Closed

[feat] Add some kind of transaction id to API responses #278

LordMike opened this issue Jan 19, 2021 · 12 comments · Fixed by #281
Assignees
Labels
enhancement New feature or request

Comments

@LordMike
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When issuing getNodes or similar over MQTT, it can take a long time to get a response. Likewise, when issuing many commands over MQTT, like setValue or getAssociations, it can be tricky to seperate requests from responses, since the responses all look alike. At least for those with arguments, one can compare the arguments to verify it's what we wanted..

Describe the solution you'd like
Add another value to requests, which is optional, and merely echoed back on responses. Like transaction, id or token.

Sent:

zwavejs2mqtt/_CLIENTS/ZWAVE_GATEWAY-HomeMQTT/api/getAssociations/set
{"args":[10,20],"token":"abc"}

Response:

zwavejs2mqtt/_CLIENTS/ZWAVE_GATEWAY-HomeMQTT/api/getAssociations
{"args":[10,20],"token":"abc","data":{..some data..}}

This way a client can create their own identifier and match up responses.

Describe alternatives you've considered
I'm currently comparing arguments, but comparing json objects is cumbersome, at least in .NET.

Additional context
N/A

@LordMike LordMike added the enhancement New feature or request label Jan 19, 2021
@robertsLando
Copy link
Member

Absolutely! Nice idea :)

@robertsLando
Copy link
Member

@LordMike Ready 🚀

@LordMike
Copy link
Contributor Author

Wouldn't this still require me to compare json objects? :)

@robertsLando
Copy link
Member

robertsLando commented Jan 20, 2021

@LordMike If you add an id to the request message, you will find the same id in the response payload origin.id

@LordMike
Copy link
Contributor Author

Oh.. You're right.

👍

@LordMike
Copy link
Contributor Author

LordMike commented Jan 20, 2021

That means args are duplicated :D ... origin.args & args

@robertsLando
Copy link
Member

Yep was to keep back compatibility but I could remove it

@LordMike
Copy link
Contributor Author

Yep was to keep back compatibility but I could remove it

Entirely up to you. I'm satisfied :)

@LordMike
Copy link
Contributor Author

@robertsLando did this feature disappear?

I'm not seeing my original request, on 6.2.0

@LordMike
Copy link
Contributor Author

LordMike commented Dec 28, 2021

robertsLando added a commit that referenced this issue Dec 29, 2021
@robertsLando
Copy link
Member

@LordMike fixed

@LordMike
Copy link
Contributor Author

Great :)

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

Successfully merging a pull request may close this issue.

2 participants