RobotWebTools / ros2-web-bridge

Bridging your browser to the ROS 2.0
Apache License 2.0
209 stars 68 forks source link

Multiple subscriptions support #65

Open qiuzhong opened 6 years ago

qiuzhong commented 6 years ago

In terms of the subscribe-related operations, like subscribe and unsubscribe, the id field is to identify the subscriptions when the topic is same. According to the rosbridge v2 protocol subscribe section:

id – if specified, then this specific subscription can be unsubscribed by referencing the ID.

and unsubscribe section:

If an id is provided, then only the corresponding subscription is unsubscribed. If no ID is provided, then all subscriptions are unsubscribed.

All the operations should support multiple subscriptions action. The id field can be useful to identify them.

This feature should be supported by the bridge.

minggangw commented 6 years ago

Would you please check if the roslibjs can support the id section, as roslibjs is the only JavaScript library we can use.

qiuzhong commented 6 years ago

I checked the examples by launching two subscription.html instances. They have the same id when sending request to create subscription. So I guest roslibjs doesn't require id section when calling the API but it will construct the id field automatically.

{"op":"subscribe","id":"subscribe:/example_topic:1","type":"std_msgs/String","topic":"/example_topic","compression":"none","throttle_rate":0,"queue_length":0}

And both instances work well.