Proxy websocket when running local environment.

This commit is contained in:
Simon Lindh
2019-08-29 01:05:46 +02:00
parent e3586c750b
commit e14786e8aa
3 changed files with 9 additions and 4 deletions

View File

@@ -2,5 +2,10 @@
"/api": {
"target": "http://localhost:8999/",
"secure": false
},
"/ws": {
"target": "http://localhost:8999/",
"secure": false,
"ws": true
}
}

View File

@@ -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({