Add client connection mode using the unused --address CLI argument #132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have a setup with a internal (local) ROS network and an external (master) websocket server. The external server has a public websocket address, but the ROS network is not exposed.
This PR allows the web bridge to be a websocket client that connects to the external server - requests can be issued by the server and proxied into the local network the same way a regular client would connect to the ros2-web-bridge as before. The
--address
arg was apparently totally unused, so I co-opted that to open a client connection instead of a server connection.In the new test I added, there's a
setTimeout
I'm not particularly proud of. Without this timeout, the test would fail every 4-5 runs due to a race condition in the WS library - with the timeout, the test passes ~50x in a row. I tried other options includingprocess.nexttick
to no avail... I'm open to suggestions on a better way.