1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

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