Stefan Huber

timeout after 2000 millis in local network

...@@ -2,6 +2,7 @@ import {Injectable} from '@angular/core'; ...@@ -2,6 +2,7 @@ import {Injectable} from '@angular/core';
2 import {Http,Response,Headers} from '@angular/http'; 2 import {Http,Response,Headers} from '@angular/http';
3 import { DeviceInfo } from './../api/device-info'; 3 import { DeviceInfo } from './../api/device-info';
4 import { Node } from './../api/node'; 4 import { Node } from './../api/node';
5 +import 'rxjs/add/operator/timeout'
5 6
6 export const ERROR_CODE_UNAUTHORIZED:string = "unauthorized"; 7 export const ERROR_CODE_UNAUTHORIZED:string = "unauthorized";
7 export const ERROR_CODE_NOT_FOUND:string = "not-found"; 8 export const ERROR_CODE_NOT_FOUND:string = "not-found";
...@@ -100,6 +101,7 @@ export class Rest { ...@@ -100,6 +101,7 @@ export class Rest {
100 return new Promise<Node> ((resolve, reject) => { 101 return new Promise<Node> ((resolve, reject) => {
101 if (node && node.IP) { 102 if (node && node.IP) {
102 this.http.get("http://" + node.IP + ":" + Rest.localWebPort + "/device") 103 this.http.get("http://" + node.IP + ":" + Rest.localWebPort + "/device")
104 + .timeout(2000)
103 .subscribe(response => { 105 .subscribe(response => {
104 try { 106 try {
105 let body = response.json(); 107 let body = response.json();
......