Can't interconnect using the ros2router discovery server setup

Since, the HUSARNET API was not running on the beta version(2.0.321)
We used the stable version(2.0.180) and Husarnet Api was running fine,
then we tried the following methods to interconnect our local-machines(running ROS2 JAZZY) :


1st Method :

in Host-1:
Here, we ran the discovery server from the ros2router docker image, by the following command:

docker run --rm -d \
    --name ros2router \
    --net host \
    --env DISCOVERY_SERVER_LISTENING_PORT=11811 \
    --env DISCOVERY_SERVER_ID=0 \
    --env ROS_LOCALHOST_ONLY=1 \
    husarnet/ros2router:1.3.0
    
    export ROS_LOCALHOST_ONLY=1

in Host-2:
we created a superclient.xml with proper husarnet-IP and prefix
and exported it using:

export FASTRTPS_DEFAULT_PROFILES_FILE=$(pwd)/superclient.xml

Issue:
But when Host-1 publishes to a topic, Host-2 doesn’t get the topic.


2nd Method :

in Host-1 (abd-pc):
Here, we ran the “discovery server” from the ros2router docker image, by the following command:

docker run --rm -d \
    --name ros2router \
    --net host \
    --env DISCOVERY_SERVER_LISTENING_PORT=11811 \
    --env DISCOVERY_SERVER_ID=0 \
    --env ROS_LOCALHOST_ONLY=1 \
    husarnet/ros2router:1.3.0
    
    export ROS_LOCALHOST_ONLY=1

in Host-2 (tamim-pc):

here, we ran the client using:

docker run --rm -d \
    --name ros2router \
    --net host \
    --env ROS_DISCOVERY_SERVER=tamim-pc:11811 \
    --env DISCOVERY_SERVER_ID=10 \
    --env ROS_LOCALHOST_ONLY=1 \
    husarnet/ros2router:1.3.0
    
    export ROS_LOCALHOST_ONLY=1

here we also tried exporting the ros discovery server( though its for IRON, we are using JAZZY) using:

export ROS_DISCOVERY_SERVER=abd-pc:11811

Issue:
But when Host-1 publishes to a topic, Host-2 doesn’t get the topic.

Additionally, we also tried the initial peer setup but that too aint working!!?!!

We faced the same issue while trying to interconnect ROS 2 Jazzy nodes over Husarnet using the ros2router discovery server setup. The topic discovery was not happening automatically across machines.

However, we noticed that discovery only succeeded when we explicitly subscribed to the topic (from client side) along with the correct message type. Once the subscriber was running with the appropriate type, the topic from the publisher became visible and the messages started flowing.

Pavan
Team Shunya