ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

rosbridge_server: share messages to non-ROS computer using HTTP

asked 2015-07-29 19:26:05 -0600

frankb gravatar image

Is there a way to share a topic with a non-ROS computer? I am trying to send a string from my ros computer to another computer over a local static ip network. I was looking into using rosbridge_server to do this as it claims "Rosbridge provides a JSON API to ROS functionality for non-ROS programs."

I followed the tutorial: and used roslibjs as indicated here:

While testing solely on my ros computer, I was able to subscribe to my topic over a websocket and have the string displayed on the web console using this HTML code:

<!DOCTYPE html>
<meta charset="utf-8" />

<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>

<script type="text/javascript" type="text/javascript">
  // Connecting to ROS
  // -----------------

  var ros = new ROSLIB.Ros({
    url : 'ws://localhost:9090'

  ros.on('connection', function() {
    console.log('Connected to websocket server.');

  ros.on('error', function(error) {
    console.log('Error connecting to websocket server: ', error);

  ros.on('close', function() {
    console.log('Connection to websocket server closed.');

  // Subscribing to a Topic
  // ----------------------

  var listener = new ROSLIB.Topic({
    ros : ros,
    name : '/copter_center_str',
    messageType : 'std_msgs/String'

  listener.subscribe(function(message) {
    console.log('Received message on ' + + ': ' +;


  <h1>Simple roslib Example</h1>
  <p>Check your Web Console for output.</p>

However, this method requires a web connection to include eventemitter2 and roslib. I tried installing both libraries and writing a javascript file to do it offline, but did not work as there were issues installing roslib.

It seems like roslib is designed to be used as a web interface to access ROS topics and services. Can rosbridge be used to give another computer access to a single topic and its messages over a local offline connection? If not, how is this interaction typically done? It would be perfect if there existed an HTTP call to subscribe to a topic on the rosbridge server.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-07-30 09:18:33 -0600

rtoris288 gravatar image

rosbridge is simply a protocol specification for external clients to communicate with ROS ( ). By running rosbridge server, you are allowing any external client to connect to a ROS system via either a WebSocket or TCP connection (depending on which server you start). roslibjs is a JavaScript client library; however it is not the only option. A Java implementation also exists ( ) any other languages can also implement the protocol and become a client as well.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-07-29 19:26:05 -0600

Seen: 1,610 times

Last updated: Jul 30 '15