Skip to content

Commit

Permalink
Add optional timeout argument to callService (#835)
Browse files Browse the repository at this point in the history
* Add optional timeout argument to callService

* Pass timeout property even if it is undefined
  • Loading branch information
bjsowa authored Jan 23, 2025
1 parent 3c9dbce commit 62b791f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ export default class Service extends EventEmitter {
* @param {TRequest} request - The service request to send.
* @param {callServiceCallback} [callback] - Function with the following params:
* @param {callServiceFailedCallback} [failedCallback] - The callback function when the service call failed with params:
*/
callService(request, callback, failedCallback) {
* @param {number} [timeout] - Optional timeout, in seconds, for the service call. A non-positive value means no timeout.
* If not provided, the rosbridge server will use its default value.
*/
callService(request, callback, failedCallback, timeout) {
if (this.isAdvertised) {
return;
}
Expand All @@ -71,8 +73,10 @@ export default class Service extends EventEmitter {
id: serviceCallId,
service: this.name,
type: this.serviceType,
args: request
args: request,
timeout: timeout
};

this.ros.callOnConnection(call);
}
/**
Expand Down

0 comments on commit 62b791f

Please sign in to comment.