Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cascade-examples
rigado-node-hello-world-frontend
Commits
0a36ec15
Commit
0a36ec15
authored
Apr 13, 2018
by
Vladimir Kiryakov
Browse files
wait for device status one sec before show disconnected status
parent
19607438
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/middlewares/mqtt.js
View file @
0a36ec15
import
mqtt
from
'
mqtt
'
;
import
{
MQTT_CONNECT
,
MQTT_DISCONNECT
}
from
'
../actions/mqtt
'
;
import
{
connected
,
disconnected
,
changeConnectionStatus
,
pushMessages
}
from
'
../actions/mqtt
'
;
import
{
connected
,
disconnected
,
changeConnectionStatus
,
pushMessages
,
GATEWAY_DISCONNECTED
}
from
'
../actions/mqtt
'
;
import
_
from
'
lodash
'
;
import
config
from
'
../config
'
;
const
debounceApply
=
_
.
debounce
((
apply
)
=>
{
apply
();
},
1000
);
const
mqttMiddleware
=
(
function
()
{
let
url
=
null
;
let
topic
=
null
;
...
...
@@ -55,6 +59,9 @@ const mqttMiddleware = (function () {
});
}
store
.
dispatch
(
changeConnectionStatus
(
_
.
get
(
json
,
'
status
'
)));
debounceApply
(()
=>
{
store
.
dispatch
(
changeConnectionStatus
(
GATEWAY_DISCONNECTED
))
});
}
});
}
catch
(
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment