Fix websockets on other ports than 80

Former-commit-id: 92fc9e1bd2c7590af98c5246a7e035a3ca8f3d6f [formerly 3cbab224088f675ab9474a78682db7956f90a39e] [formerly 395d28fc36802680a6a30065cad749101c256753 [formerly 736e7d6167]]
Former-commit-id: 5cfac7b10ccaf36c3969164df5af8dee4a27a9a5 [formerly 8e8283eba1ae1c5bf0da72927a775fdac2e3ef79]
Former-commit-id: 9a89cbe037984be71de125da051a92aa0d1636ab
This commit is contained in:
Henrique Dias 2017-07-27 14:02:50 +01:00
parent 63fb4c0c52
commit 8b40dc9d19
1 changed files with 2 additions and 2 deletions

View File

@ -163,7 +163,7 @@ function checksum (url, algo) {
function command (url, command, onmessage, onclose) {
let protocol = (ssl ? 'wss:' : 'ws:')
url = removePrefix(url)
url = `${protocol}//${window.location.hostname}${store.state.baseURL}/api/command${url}`
url = `${protocol}//${window.location.host}${store.state.baseURL}/api/command${url}`
let conn = new window.WebSocket(url)
conn.onopen = () => conn.send(command)
@ -174,7 +174,7 @@ function command (url, command, onmessage, onclose) {
function search (url, search, onmessage, onclose) {
let protocol = (ssl ? 'wss:' : 'ws:')
url = removePrefix(url)
url = `${protocol}//${window.location.hostname}${store.state.baseURL}/api/search${url}`
url = `${protocol}//${window.location.host}${store.state.baseURL}/api/search${url}`
let conn = new window.WebSocket(url)
conn.onopen = () => conn.send(search)