diff --git a/backend/src/index.ts b/backend/src/index.ts index c0a327230..ef6475169 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -50,8 +50,8 @@ class MempoolSpace { statistics.startStatistics(); fiatConversion.startService(); - let opts = { - host: "127.0.0.1", + const opts = { + host: '127.0.0.1', port: 8999 }; this.server.listen(opts, () => { diff --git a/frontend/proxy.conf.json b/frontend/proxy.conf.json index 8a5402c52..bd32da01d 100644 --- a/frontend/proxy.conf.json +++ b/frontend/proxy.conf.json @@ -2,5 +2,10 @@ "/api": { "target": "http://localhost:8999/", "secure": false + }, + "/ws": { + "target": "http://localhost:8999/", + "secure": false, + "ws": true } } \ No newline at end of file diff --git a/frontend/src/app/services/api.service.ts b/frontend/src/app/services/api.service.ts index e0bf4b052..3b3f20185 100644 --- a/frontend/src/app/services/api.service.ts +++ b/frontend/src/app/services/api.service.ts @@ -6,8 +6,8 @@ import { Observable } from 'rxjs'; import { MemPoolService } from './mem-pool.service'; import { tap, retryWhen, delay } from 'rxjs/operators'; -const WEB_SOCKET_PROTOCOL = (document.location.protocol == 'https:') ? 'wss:' : 'ws:'; -const WEB_SOCKET_URL = WEB_SOCKET_PROTOCOL + '//' + document.location.hostname + '/ws'; +const WEB_SOCKET_PROTOCOL = (document.location.protocol === 'https:') ? 'wss:' : 'ws:'; +const WEB_SOCKET_URL = WEB_SOCKET_PROTOCOL + '//' + document.location.hostname + ':' + document.location.port + '/ws'; const API_BASE_URL = '/api/v1'; @Injectable({