GUI2 changed web socket port to follow main window port rather than hardcode
Change-Id: I0ea090f628ee60f9d930be9307daa8d081465d97
diff --git a/web/gui2/src/main/webapp/app/onos.component.ts b/web/gui2/src/main/webapp/app/onos.component.ts
index f12593d..30c4d2b 100644
--- a/web/gui2/src/main/webapp/app/onos.component.ts
+++ b/web/gui2/src/main/webapp/app/onos.component.ts
@@ -13,7 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { Component, OnInit, AfterViewInit, OnDestroy } from '@angular/core';
+import {
+ Component,
+ OnInit,
+ AfterViewInit,
+ OnDestroy,
+ Inject
+} from '@angular/core';
import { Observable, Subscription, fromEvent } from 'rxjs';
import * as d3 from 'd3';
import {
@@ -84,7 +90,8 @@
private ks: KeysService,
public wss: WebSocketService,
private log: LogService,
- public onos: OnosService
+ public onos: OnosService,
+ @Inject('Window') private window: any
) {
// This is not like onos.js of AngularJS 1.x In this new structure modules are
@@ -97,7 +104,7 @@
log.warn('OnosComponent: testing logger.warn()');
log.error('OnosComponent: testing logger.error()');
- this.wss.createWebSocket(<WsOptions>{ wsport: 8181});
+ this.wss.createWebSocket(<WsOptions>{ wsport: this.window.location.port});
log.debug('OnosComponent constructed');
}