connect to socket with access token

This commit is contained in:
Luke Pulverenti 2015-03-08 15:48:30 -04:00
parent a97701541a
commit 5fd8da389b

View File

@ -337,7 +337,12 @@
self.openWebSocket = function () {
if (!accessToken) {
throw new Error("Cannot open web socket without access token.");
}
var url = serverAddress.replace('http', 'ws');
url += "?api_key=" + accessToken;
webSocket = new WebSocket(url);
@ -351,12 +356,8 @@
logger.log('web socket connection opened');
setTimeout(function () {
self.sendWebSocketMessage("Identity", clientName + "|" + deviceId + "|" + applicationVersion + "|" + deviceName);
Events.trigger(self, 'websocketopen');
}, 500);
}, 0);
};
webSocket.onerror = function () {
setTimeout(function () {