From 1866aed43285e5e652583e74934c14bc39446c41 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Fri, 17 Aug 2018 16:07:48 +1000 Subject: [PATCH] Accomodate for upcoming signature in websocket connection header --- js/modules/web_api.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/modules/web_api.js b/js/modules/web_api.js index d27b726c6..69ee799b4 100644 --- a/js/modules/web_api.js +++ b/js/modules/web_api.js @@ -140,7 +140,7 @@ function _validateResponse(response, schema) { return true; } -function _createSocket(url, { certificateAuthority, proxyUrl }) { +function _createSocket(url, { certificateAuthority, proxyUrl, signature }) { let requestOptions; if (proxyUrl) { requestOptions = { @@ -152,9 +152,16 @@ function _createSocket(url, { certificateAuthority, proxyUrl }) { ca: certificateAuthority, }; } + // TODO: sign a timestamp + let headers; + if (signature) { + headers = { + signature + }; + } // eslint-disable-next-line new-cap - return new WebSocket(url, null, null, null, requestOptions); + return new WebSocket(url, null, null, headers, requestOptions); } function _promiseAjax(providedUrl, options) {