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:
parent
a97701541a
commit
5fd8da389b
1 changed files with 6 additions and 5 deletions
|
@ -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 () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue