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

@ -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 });
});
}