about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-05-17 20:52:58 +0200
committerThibaut Girka <thib@sitedethib.com>2019-05-24 16:08:09 +0200
commit7fb76999af8a14bb1761eebcf23b65f51067054f (patch)
treee4d2533bdb3ff0e3a6a30b26eb1268a312ddb4f3 /app/javascript/flavours/glitch
parent652147a3f41e4f2031d4a26a8378265aaa6e76b8 (diff)
Use Sec-WebSocket-Protocol instead of query string to pass WebSocket token
Inspired by https://github.com/kubevirt/kubevirt/issues/1242
Diffstat (limited to 'app/javascript/flavours/glitch')
-rw-r--r--app/javascript/flavours/glitch/util/stream.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/app/javascript/flavours/glitch/util/stream.js b/app/javascript/flavours/glitch/util/stream.js
index 306a068b7..c4642344f 100644
--- a/app/javascript/flavours/glitch/util/stream.js
+++ b/app/javascript/flavours/glitch/util/stream.js
@@ -71,11 +71,7 @@ export function connectStream(path, pollingRefresh = null, callbacks = () => ({
 export default function getStream(streamingAPIBaseURL, accessToken, stream, { connected, received, disconnected, reconnected }) {
   const params = [ `stream=${stream}` ];
 
-  if (accessToken !== null) {
-    params.push(`access_token=${accessToken}`);
-  }
-
-  const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?${params.join('&')}`);
+  const ws = new WebSocketClient(`${streamingAPIBaseURL}/api/v1/streaming/?${params.join('&')}`, accessToken);
 
   ws.onopen      = connected;
   ws.onmessage   = e => received(JSON.parse(e.data));