roslibjs icon indicating copy to clipboard operation
roslibjs copied to clipboard

What server to run for socket.io support

Open Rayman opened this issue 6 years ago • 5 comments

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).

Rayman avatar Feb 25 '19 16:02 Rayman

Did you ever figure out the problem? Getting the same error

Moth-Man avatar Jan 27 '20 22:01 Moth-Man

Unfortunately no, I'm now running a normal websocket with some reconnect logic.

Rayman avatar Jan 28 '20 09:01 Rayman

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)

VadimCiv avatar Jul 24 '21 12:07 VadimCiv

Same here ReferenceError: io is not defined Anybody can explain how to use transportLibrary: 'socket.io'?

VadimCiv avatar Aug 16 '21 08:08 VadimCiv

Even I am getting the same error, any workarounds?

rohanshukla94 avatar Feb 24 '22 07:02 rohanshukla94