Skip to content

Commit 5596f25

Browse files
authoredMay 14, 2017
Merge pull request #50 from PedalPi/issue-38-update-view-when-receive-websocket-message
Issue 38 update view when receive websocket message
2 parents b79a2de + 48a65c7 commit 5596f25

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎src/providers/websocket/web-socket-service.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {Injectable} from '@angular/core';
44
import {PedalPiMessageDecoder} from './pedalpi-message-decoder';
55
import {ConnectionView} from './connection-view';
66

7+
import {ApplicationRef} from '@angular/core';
8+
79

810
export interface MessageDecoder {
911
onMessage(message : any);
@@ -26,7 +28,7 @@ export class WebSocketService {
2628

2729
public view : ConnectionView;
2830

29-
constructor(private data : DataService) {
31+
constructor(private data : DataService, private ref : ApplicationRef) {
3032
this.forceReconnection = false;
3133

3234
this.messageDecoder = new PedalPiMessageDecoder(data);
@@ -58,6 +60,7 @@ export class WebSocketService {
5860
private onMessage(message) {
5961
message = JSON.parse(message);
6062
this.messageDecoder.onMessage(message);
63+
this.ref.tick();
6164
}
6265

6366
private onConnectionOpen(url) {

0 commit comments

Comments
 (0)