Ask Your Question

Revision history [back]

Websocket server in ROS Melodic version of rosbridge-server enforces more web security then older versions. Therefore, you are not able to connect to the rosbridge-server from a HTML page that is not served from the same origin.

That is, if you simply try to open your HTML page directly from a file on your local PC then websocket connection will fail because websocket server inside of rosbridge-server will refuse such connection.

The way to solve connection issue is to have a web server serving your HTML page which you want to do eventually for your system anyway.

Here you have options. For example:

1) For simple tests running on your local Ubuntu 18.04 you can serve your HTML page(s) by running simple HTTP server provided by Python3 on your Ubuntu (see this answer)

cd /my/html/files  #directory where your HTML page is located
python3 -m http.server 8080

Then you can run your page by pointing any browser to http://localhost:8080/your_page.html (tested in both FireFox and Chrome)

2) Eventually if would like to have ROS-based system using this technology you can consider using roswww ROS package to serve your application's HTML pages. We have been successfully using it for a few years now