Accomodate for upcoming signature in websocket connection header

pull/3/head
sachaaaaa 7 years ago
parent 536908b1c4
commit 1866aed432

@ -140,7 +140,7 @@ function _validateResponse(response, schema) {
return true; return true;
} }
function _createSocket(url, { certificateAuthority, proxyUrl }) { function _createSocket(url, { certificateAuthority, proxyUrl, signature }) {
let requestOptions; let requestOptions;
if (proxyUrl) { if (proxyUrl) {
requestOptions = { requestOptions = {
@ -152,9 +152,16 @@ function _createSocket(url, { certificateAuthority, proxyUrl }) {
ca: certificateAuthority, ca: certificateAuthority,
}; };
} }
// TODO: sign a timestamp
let headers;
if (signature) {
headers = {
signature
};
}
// eslint-disable-next-line new-cap // 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) { function _promiseAjax(providedUrl, options) {

Loading…
Cancel
Save