Visualize clients going offline + Add mqtt connection details to config

This commit is contained in:
uwap 2017-11-04 00:24:48 +01:00
parent b2f1e2b07c
commit 964e3c0305
4 changed files with 13 additions and 3 deletions

View file

@ -4,7 +4,8 @@ import * as utils from './utils';
const config : Config = {
space: {
name: "RZL",
color: "orange"
color: "orange",
mqtt: "ws://map.rzl:1884"
},
topics: {
led_stahltraeger: {

View file

@ -89,4 +89,4 @@ store.subscribe(() => ReactDOM.render(<App state={store.getState()} />, document
store.dispatch({type:null});
connectMqtt("ws://172.22.36.207:1884", store);
connectMqtt(Config.space.mqtt, store);

View file

@ -23,4 +23,13 @@ export default function connectMqtt(url: string, store: Store<*,*>) {
}
});
});
client.on("offline", () => {
store.dispatch({ type: null });
});
client.on("close", () => {
store.dispatch({ type: null });
});
client.on("reconnect", () => {
store.dispatch({ type: null });
});
}

View file

@ -27,7 +27,7 @@ declare type ControlUI = {
// DROPDOWN optional properties
options?: Map<string,any>, //options for dropDown
renderValue?: (value: string) => string
renderValue?: (value: string) => string,
// SLIDER optional properties
min?: number,