Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to init websocket connection: ws does not work in the browser #501

Open
akshay-nm opened this issue Dec 24, 2021 · 2 comments
Open
Labels

Comments

@akshay-nm
Copy link

Description
I am trying to setup a web interface using svelte and this package with a turtlebot3 simulation on ros2 galactic.
I have used npm install roslib to set up this npm module in my project.

This is what I have in my client-side script (JS):

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

I have the simulation up and running with rosbridge_suite and rosbridge_server is up on port 9090 of localhost.

  • Library Version: "roslib": "^1.1.0"
  • ROS Version: galactic
  • Platform / OS: wsl2 (ubuntu 20.04)

Expected Behavior
I should be able to set up a WebSocket connection.

Actual Behavior
When I open up my web interface I get this error:

Uncaught (in promise) Error: ws does not work in the browser. Browser clients must use the native WebSocket object
    at new module.exports (browser.js:4)
    at Ros.connect (Ros.js:75)
    at new Ros (Ros.js:53)
    at getRosConnection (ros-connection.js?t=1640387808327:11)
    at __layout.svelte? [sm]:9
    at run (index.mjs:18)
    at Array.map (<anonymous>)
    at index.mjs:1749
    at flush (index.mjs:1057)
    at init (index.mjs:1841)
@akshay-nm akshay-nm added the bug label Dec 24, 2021
@desstiony
Copy link

ROS Version: galactic is ros2. you sholud use ros2-web-bridge

@MatthijsBurgh
Copy link
Contributor

rosbridge_suite has a ROS2 version. ros2-web-bridge is not actively maintained...

k-aguete pushed a commit to k-aguete/roslibjs that referenced this issue Oct 21, 2022
* (transpiler) always enable errors

* (transpiler) throw error on LogError

* (transpiler) fix properties regex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants