roslibjs
roslibjs copied to clipboard
What server to run for socket.io support
I'm trying to connect to rosbridge via socket.io as explained in the docs:
new Ros( {..., transportLibrary: 'socket.io'} );
What server supports this? I'm now running roslaunch rosbridge_server rosbridge_websocket.launch
but this only supports websockets I think (I'm getting CORS errors).
Did you ever figure out the problem? Getting the same error
Unfortunately no, I'm now running a normal websocket with some reconnect logic.
Same problem here. Trying to use Ros with transportLibrary: 'socket.io' option but still get error "ReferenceError: io is not defined" Please explain what I doing wrong?
package.json "socket.io": "^4.1.3",
var ROSLIB = require('roslib');
var io = require('socket.io');
var ros = new ROSLIB.Ros({
transportLibrary: 'socket.io',
});
export const connectToRos = (ip) => {
ros.connect(`ws://${ip}:9090`); // *** error here ***
};
Ros.js
Ros.prototype.connect = function(url) {
if (this.transportLibrary === 'socket.io') {
this.socket = assign(io(url, {'force new connection': true}), socketAdapter(this));
...
}
ReferenceError: io is not defined at Ros.push../node_modules/roslib/src/core/Ros.js.Ros.connect (Ros.js:66)
Same here ReferenceError: io is not defined Anybody can explain how to use transportLibrary: 'socket.io'?
Even I am getting the same error, any workarounds?