diff --git a/js/services/rpc/sockcall.js b/js/services/rpc/sockcall.js index 2e144a6..9e43fca 100644 --- a/js/services/rpc/sockcall.js +++ b/js/services/rpc/sockcall.js @@ -37,6 +37,7 @@ function(_, JSON, name, utils, alerts) { // when connection opens onopen: function() { + console.log('websocket initialized!!!'); sockRPC.initialized = true; }, @@ -93,7 +94,16 @@ function(_, JSON, name, utils, alerts) { } try { - sockRPC.sock = new WebSocket(sockRPC.scheme + '://' + conf.host + ':' + conf.port + '/jsonrpc'); + var authUrl = sockRPC.scheme + '://' + conf.host + ':' + conf.port + '/jsonrpc'; + if (sockRPC.conf.auth && sockRPC.conf.auth.user && sockRPC.conf.auth.pass) { + authUrl = sockRPC.scheme + '://' + + sockRPC.conf.auth.user + ":" + + sockRPC.conf.auth.pass + "@" + + sockRPC.conf.host + ':' + + sockRPC.conf.port + '/jsonrpc'; + } + + sockRPC.sock = new WebSocket(authUrl); sockRPC.sock.onopen = sockRPC.onopen; sockRPC.sock.onclose = sockRPC.onclose; sockRPC.sock.onerror = sockRPC.onerror; diff --git a/js/services/rpc/syscall.js b/js/services/rpc/syscall.js index fe0ec36..a7a6eca 100644 --- a/js/services/rpc/syscall.js +++ b/js/services/rpc/syscall.js @@ -34,6 +34,7 @@ function(log, jsonRPC, sockRPC, alerts) { opts.error = opts.error || angular.noop; if (sockRPC.initialized) { + console.log('calling sock rpc'); return sockRPC.invoke(opts); } else {