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

[Feature Request] Add metadata to service respone #279

Closed
edu-rossrobotics opened this issue Aug 14, 2024 · 5 comments · Fixed by #280
Closed

[Feature Request] Add metadata to service respone #279

edu-rossrobotics opened this issue Aug 14, 2024 · 5 comments · Fixed by #280
Labels
type: enhancement PR to improve the project.

Comments

@edu-rossrobotics
Copy link
Contributor

⚡ Feature Request

Please Describe The Problem To Be Solved
I have a board that needs to send Execute Command request to different boards and handle the response based on who is answering.

(Optional): Suggest A Solution
I've worked on a solution that allows to use a response callback function that contains the metadata so you can use it to "filter" the response based on the node. I'm not sure if this is the best approach nor if it make sense based on the design philosophy of the library.

If you think it can be useful, I already have it working so I'm happy to open a PR to add it.

Thanks.

@edu-rossrobotics edu-rossrobotics added the type: enhancement PR to improve the project. label Aug 14, 2024
@aentinger
Copy link
Member

I believe the primary design of services is to facilitate request-response style bidirectional communication between primarily two communication partners. On the other hand, GetInfo is definitely designed for multiple recipients (AFAIK). @pavel-kirienko what's your take?

@pavel-kirienko
Copy link
Member

I believe the primary design of services is to facilitate request-response style bidirectional communication between primarily two communication partners.

Correct.

On the other hand, GetInfo is definitely designed for multiple recipients (AFAIK).

Nope, it's also request-response. You can snoop on third party responses if you want but it's not, strictly speaking, how it is supposed to be used.

@edu-rossrobotics
Copy link
Contributor Author

So, in that case how would you handle a situation like this?

You have a device A sending the same service request to 2 different devices (B and C). When you receive the responses back, one has succeed while the other one failed. How can you know which device sent each response? Are you assuming the responses will arrive in the same order you sent the request?

@pavel-kirienko
Copy link
Member

The library should provide the user with sufficient context to distinguish the two responses.

@aentinger
Copy link
Member

Well, I suppose let's have a look at your code then. How about preparing a PR showing your changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement PR to improve the project.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants