diff --git a/embark-ui/src/services/api.js b/embark-ui/src/services/api.js index 1766b690..cdcd3301 100644 --- a/embark-ui/src/services/api.js +++ b/embark-ui/src/services/api.js @@ -136,23 +136,22 @@ export function authenticate(payload) { return post('/authenticate', {...payload, credentials: payload}); } -// TODO token for WS? export function listenToChannel(credentials, channel) { - return new WebSocket(`ws://${credentials.host}/communication/listenTo/${channel}`); + return new WebSocket(`ws://${credentials.host}/embark-api/communication/listenTo/${channel}`, [credentials.token]); } export function webSocketProcess(credentials, processName) { - return new WebSocket(`ws://${credentials.host}/process-logs/${processName}`); + return new WebSocket(`ws://${credentials.host}/embark-api/process-logs/${processName}`, [credentials.token]); } export function webSocketContractLogs(credentials) { - return new WebSocket(`ws://${credentials.host}/contracts/logs`); + return new WebSocket(`ws://${credentials.host}/embark-api/contracts/logs`, [credentials.token]); } export function webSocketBlockHeader(credentials) { - return new WebSocket(`ws://${credentials.host}/blockchain/blockHeader`); + return new WebSocket(`ws://${credentials.host}/embark-api/blockchain/blockHeader`, [credentials.token]); } export function websocketGasOracle(credentials) { - return new WebSocket(`ws://${credentials.host}/blockchain/gas/oracle`); + return new WebSocket(`ws://${credentials.host}/embark-api/blockchain/gas/oracle`, [credentials.token]); } diff --git a/lib/modules/webserver/server.js b/lib/modules/webserver/server.js index 07748460..936e96df 100644 --- a/lib/modules/webserver/server.js +++ b/lib/modules/webserver/server.js @@ -163,10 +163,8 @@ class Server { } applyAPIFunction (cb, req, res) { - // FIXME Need to not authenticate WS request as they do not pass the toekn in the header yet const authToken = (!res.send) ? req.protocol : req.headers.authorization; if (!res.send) { - // console.dir(arguments); return cb(req, res); } this.events.request('authenticator:authorize', authToken, (err) => {