Merge pull request #5095 from jaredevantabor/remove-token-from-sockets

removing token from websocket connection url
This commit is contained in:
Wayne Witzel III 2017-02-01 09:27:22 -05:00 committed by GitHub
commit eada4ce83f

View File

@ -5,8 +5,8 @@
*************************************************/
import ReconnectingWebSocket from 'reconnectingwebsocket';
export default
['$rootScope', '$location', '$log','$state', '$q', 'i18n', 'Authorization',
function ($rootScope, $location, $log, $state, $q, i18n, Authorization) {
['$rootScope', '$location', '$log','$state', '$q', 'i18n',
function ($rootScope, $location, $log, $state, $q, i18n) {
var needsResubscribing = false,
socketPromise = $q.defer();
return {
@ -14,8 +14,7 @@ export default
var self = this,
host = window.location.host,
protocol,
url,
token = Authorization.getToken();
url;
if($location.protocol() === 'http'){
protocol = 'ws';
@ -26,8 +25,7 @@ export default
url = `${protocol}://${host}/websocket/`;
if (!$rootScope.sessionTimer || ($rootScope.sessionTimer && !$rootScope.sessionTimer.isExpired())) {
// We have a valid session token, so attempt socket connection
url = `${url}?token=${token}`;
$log.debug('Socket connecting to: ' + url);
self.socket = new ReconnectingWebSocket(url, null, {