Reputation: 241
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);
}
Upvotes: 0
Views: 138
Reputation: 486
There are to options:
var connectionIP = 8.8.8.8;
var connection = new autobahn.Connection({url:'ws://'+connectionIP+':8080/ws', realm: 'realm1'});
Upvotes: 1