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

Add optional timeout argument to callService #835

Merged

Conversation

bjsowa
Copy link
Contributor

@bjsowa bjsowa commented Jan 20, 2025

Public API Changes
Added optional timeout argument to callService.

Description
After RobotWebTools/rosbridge_suite#984 was merged, it is now possible to specify a timeout when calling a service. This PR exposes this functionality to roslibjs public API.

@bjsowa bjsowa force-pushed the feature/call-service-timeout branch from 522e658 to 72630a5 Compare January 23, 2025 16:45
Copy link
Contributor

@EzraBrooks EzraBrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an awesome addition, I have a client-side hack around the lack of this in my application. I have an implementation question though

Comment on lines 76 to 82
args: request
};

if (timeout !== undefined) {
call.timeout = timeout;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that this can't be put in the definition of the object above? Does passing timeout: undefined into rosbridge break it? That seems like an API issue, since it can be tricky to easily discern in a JavaScript application whether something is deliberately undefined or missing.

I'd rather this read

Suggested change
args: request
};
if (timeout !== undefined) {
call.timeout = timeout;
}
args: request,
timeout: timeout
};

and if this causes an issue in rosbridge we should fix it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that properties with undefined value are just being omitted when converted to JSON.

@bjsowa bjsowa requested a review from EzraBrooks January 23, 2025 17:54
@EzraBrooks EzraBrooks merged commit 62b791f into RobotWebTools:develop Jan 23, 2025
2 checks passed
@bjsowa bjsowa deleted the feature/call-service-timeout branch January 24, 2025 11:35
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 this pull request may close these issues.

2 participants