I am using below javascript code to connect to autobahn server. All these times I was using static ip but now the ip is going to be dynamic. How can I pass dynamic server ip and get autobahn connected dynamically?
var connection = new autobahn.Connection({url: 'ws://<ip>:8080/ws', realm: 'realm1'});
var openSession = null;
connection.onopen = function (session) {
openSession = session;
window.JSInterface.isConnected(true);
};
connection.onClose = function(reason, details) {
openSession = null;
window.JSInterface.isConnected(false);
}
There are to options:
var connectionIP = 8.8.8.8; var connection = new autobahn.Connection({url:'ws://'+connectionIP+':8080/ws', realm: 'realm1'});