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 () {
|
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 () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue