Error during WebSocket handshake

Hey there!

I’ve been doing the web interfaces course, but stumbled upon an error trying to use the rosbridge for the first time. For some reason, the web page refuses to connect. I use the address found using rosbridge_address in Vue, but to no use.

All I get are the following errors in the console:

roslib.min.js:1 WebSocket connection to ‘wss://’ failed: Error during WebSocket handshake: Unexpected response code: 400

Event {isTrusted: true, type: “error”, target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}

Do anyone know how to fix this, or what am I doing wrong? Thanks in advance!

Alright, I managed to fix it - I should’ve included :9090 at the end of the rosbridge address. Weird, because the examples supposedly work without it?

But I stumbled upon another problem, then - no matter what I do, no matter how I code the .html and .js, the code works, the webpage appears, it connects to rosbridge… but nothing is published to cmd_vel. Not only this, but nothing appears in the rosbridge terminal, either, like my connection that I made in the webpage doesn’t exist.

Does anybody know what’s causing this problem, or a solution? I’ve been stumped for a day on this now, tried to check with a rostopic echo the cmd_vel, tried publishing through vue, nothing. I’ve been kind of frustrated with this and need help. Thanks in advance!

HI @FelipeFF,

It turns out we had some modifications in the course configuration and the notebook went outdated.

In onder to have rosbridge websocket server working properly, you must use the launch file:

roslaunch course_web_dev_ros web.launch

Which sets correctly the port number and map the correctly address to your course computer, so you don’t need to use the port number at the end of the address.
You can see below the code of the given launch file in order to understand how it does:

    <!-- This is the rosbridge part, you only need that -->
    <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch">
        <arg name="port" value="9090" />
        <arg name="websocket_external_port" value="$(env SLOT_ROSBRIDGE_PORT)" />
    <!-- This is the web video server, not used for this unit -->
    <node name="web_video_server" pkg="web_video_server" type="web_video_server">
        <param name="port" value="11315" />

Sorry for the inconvenience and thanks for sharing this issue. We are going to update the notebooks in order to avoid this problem.

Please, let me know if it works for you.


It works!

Thank you a lot! ^^

1 Like