How can I run an ign gazebo server/client pair with websocket?

I can run an ignition server with ign gazebo -s, and then connect a UI to it (on the same host) with ign gazebo -g.

It feels like it should be possible to run ign gazebo -g on a different computer and connect to ign gazebo -s over the network, as e.g. the web UI defaults to ws://localhost:9002.

  1. How can I have ign gazebo -s start the websocket server?
  2. How can I have ign gazebo -g connect over a websocket to the websocket server from 1?

Both computers have to have the same value of environment variable IGN_PARTITION (and also IGN_TRANSPORT_TOPIC_STATISTICS set to either 0 or 1 on both machines). And they have to be connected over LAN. Then you don’t need to do anything about WebSockets and they connect. If you need this to work over WAN, then the WebSocket server and web client would probably be better (or you can connect the two computers with a VPN).

I see… and how can I run the websocket server in CLI (I don’t see anything related to websocket in ign gazebo -h :confused:)?

Also, is it possible to connect the client over websocket (with ign gazebo -g), or is websocket only working with the web UI (i.e. not the “desktop” UI started with ign gazebo -g)?

If something hasn’t changed, you have to run the websocket server in your ign launch file explicitly: subt/cloudsim_sim.ign at master · osrf/subt · GitHub . And I think the gazebo -g GUI cannot utilize this connection.

As mentioned above, the websocket is in gz-launch. You can run the websocket from the command line using ign launch (as opposed to ign gazebo), like so:
ign launch gz-launch/examples/websocket.gzlaunch
(That’s this file gz-launch/websocket.gzlaunch at gz-launch6 · gazebosim/gz-launch · GitHub)

It’s basically the same setup as the SubT .ign file linked above, but this one is shipped with Gazebo.

1 Like