about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-05-17 20:52:58 +0200
committermultiple creatures <dev@multiple-creature.party>2019-11-19 13:43:21 -0600
commit74b18e0d26bb7ef4ed539c55a33be537a6335129 (patch)
tree2485d5395f3751b774aa7fd64615676b82cf131a /app
parent64a68bf2ea2d750894e55ab1b0f8024466e6f8ad (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')
-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));