0
$\begingroup$

Rosanswers logo

I have already rosrun rosbridge rosbridge.py

And then when I run a test html file in browser "connection closed" has been showed...why it can`t connect to rosbridge?

html file:






function main() {
var connection = new ros.Connection("ws://hostname:9090");
connection.setOnClose(function (e) {
document.write('connection closed');
});
connection.setOnError(function (e) {
document.write('error!');
});
connection.setOnOpen(function (e) {
document.write('connected to ROS');
});
}






Originally posted by koprenee on ROS Answers with karma: 15 on 2012-07-19

Post score: 0


Original comments

Comment by Felix Endres on 2012-07-19:
You have no tags on your question, it is unlikely to be found by people who know about these things

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Could you test using the head version of rosbridge (svn url: http://brown-ros-pkg.googlecode.com/svn/trunk/experimental/rosbridge/). It's possible that you're experiencing a bug that has since been fixed but hasn't propagated to the latest version yet.

As for the "closed 10" error - the current version of rosbridge isn't very good at displaying meaningful errors. We're currently working on a more robust version of rosbridge which deals with this kind of thing much more gracefully. For now though, it may say "closed 10" even though you are actually connected.


Originally posted by Jon Mace with karma: 431 on 2012-07-20

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$
0
$\begingroup$

Rosanswers logo

A possible problem is that ws://hostname:9090 is unlikely to be your machine name. Use ws://localhost:9090 or ws://:9090 (eg. ws://192.168.0.1:9090)

If that doesn't help, could you tell me what browser you're using? There are a variety of websocket client implementations out there; some older browsers use variants of the protocol that may be outdated and therefore not compatible with rosbridge. If you find that you are using an old or obscure browser, can you try testing your code on the latest chromium or firefox and see if that helps?

Thanks, Jon


Originally posted by Jon Mace with karma: 431 on 2012-07-20

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.