Topic publishing via internet using web server
I'd like to publish ros topics from remote PC using web server via internet network. I use roswww and rosbridge_server. In local network, it works. I mean, accessing "192.168.xxx.xxx:8085/ws/pub.html" from remote PC in the same local network succeed. I used chrome browser, and the script in the html file worked correctly. But via internet, same html doesn't work. I mean, accessing "(global IP address)/ws/pub.html" from remote PC in another network failed. The contents of the html file was showed correctly but ros.on connection in the script was failed. It seems establishing server and network setting (port mapping in internet router) are working, but there are any other factors to make ros topic publisher work correctly. Now I have no idea to solve or debug this problem (I'm just a beginner of ROS). Please give me some advices. The javascript script in the html is below:
if(!Talker){
var Talker = {
ros : null,
name : "",
init : function(){
this.ros = new ROSLIB.Ros();
this.ros.on('error', function(error) {
document.getElementById('state').innerHTML = "Error";
});
this.ros.on('connection', function(error) {
document.getElementById('state').innerHTML = "Connect";
});
this.ros.on('close', function(error) {
document.getElementById('state').innerHTML = "Close";
});
this.ros.connect('ws://' + location.hostname + ':9090');
},
send : function(){
if(document.getElementById("comment").value.length == 0) return;
var comment = document.getElementById("comment").value;
var pub = new ROSLIB.Topic({
ros : this.ros,
name : '/chatter',
messageType : 'std_msgs/String'
});
var str = new ROSLIB.Message({data : comment});
pub.publish(str);
}
}
Talker.init();
window.onload = function(){
};
window.onunload = function(){
Talker.ros.close();
};
}