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

Request/Response to Meta message flow issue #1506

Closed
godind opened this issue Dec 20, 2022 · 4 comments · Fixed by #1511
Closed

Request/Response to Meta message flow issue #1506

godind opened this issue Dec 20, 2022 · 4 comments · Fixed by #1511

Comments

@godind
Copy link
Contributor

godind commented Dec 20, 2022

The request/response 'PENDING' state does not have a statusCode key and value.

Steps to reproduce

NOTE: Set yourself up to monitor webSocket delta request/response message sequence sent by the server.

  1. Create and send a delta PUT request/response to a meta path key
put: {path: 'electrical.batteries.0.voltage.meta.timeout', value: 1}
requestId: 'a9f2a3ff-fd06-4829-8272-133549e72e99'
  1. You will receive a PUT 'PENDING' and 'COMPLETED' message followed by a delta meta update message coming from the server

Request

context: 'vessels.self'
put: {path: 'electrical.batteries.0.voltage.meta.units', value: 'V'}
requestId: 'e49578bf-5502-458f-88b7-adf24a1bd201'

Pending

href: '/signalk/v1/requests/e49578bf-5502-458f-88b7-adf24a1bd201'
requestId: 'e49578bf-5502-458f-88b7-adf24a1bd201'
state: 'PENDING'
user: 'myusername'

Completed

state :'COMPLETED',
requestId: 'e49578bf-5502-458f-88b7-adf24a1bd201'
statusCode :200
href :'/signalk/v1/requests/e49578bf-5502-458f-88b7-adf24a1bd201'
user: 'myusername'

Issue

In step 2 when you receive the 'PENDING' request/response answer to your PUT, the 'PENDING' state message does not have a statusCode key. This behaviour if different than when using PUT to other paths such path values or request device access and login. The message also include a href key - not sure if it's abnormal. It does not seem to cause problems but it's the first time I see this key and it's not mentioned in the specs.

Expected behaviour

statusCode key in PENDING state should be present and have a 202 code, or some other code indicating pending state to align with other types of response flow or remove the PENDING state message from the flow *if possible.

tkurki added a commit that referenced this issue Jan 1, 2023
Initialise the statusCode of the request always to 202 along
with state: 'PENDING' when it is created. Remove setting the
statusCode to 202 that was only in the http put handling code
path.

Fixes #1506.
@tkurki
Copy link
Member

tkurki commented Jan 1, 2023

Please check the linked PR #1511 if it fixes the issue for you.

href is documented in https://signalk.org/specification/1.7.0/doc/request_response.html?highlight=href#http

@godind
Copy link
Contributor Author

godind commented Jan 1, 2023

@tkurki href is documented but only mentioned for HTTP and not for 'WebSocket and other full-duplex protocols'. I would also add statusCode 202 to the list of possible codes.

By the way, I can submit Spec PRs and help. I had actually fixed this very problem and was just about to submit it ;) Let me know how to best proceed next time.

@godind
Copy link
Contributor Author

godind commented Jan 1, 2023

@tkurki what's the best way o test a PR? Simply get the branch, run and validate or is there a special way to get the PR code?

@godind
Copy link
Contributor Author

godind commented Jan 1, 2023

@tkurki PR #1511 does fix the issue. Great work! Thanks

tkurki added a commit that referenced this issue Jan 2, 2023
Initialise the statusCode of the request always to 202 along
with state: 'PENDING' when it is created. Remove setting the
statusCode to 202 that was only in the http put handling code
path.

Fixes #1506.
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

Successfully merging a pull request may close this issue.

2 participants