Skip to content
GitLab
Menu
Projects
Groups
Snippets
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
03e072f2
Commit
03e072f2
authored
Apr 07, 2018
by
Vladimir Kiryakov
Browse files
fix edge error
parent
587b3eeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/middlewares/mqtt.js
View file @
03e072f2
...
...
@@ -10,7 +10,6 @@ const mqttMiddleware = (function () {
let
reconnectPeriod
=
null
;
let
client
=
null
;
let
interval
=
null
;
let
decoder
=
new
TextDecoder
(
"
utf-8
"
);
return
(
store
)
=>
{
let
messages
=
[];
if
(
interval
)
clearInterval
(
interval
);
...
...
@@ -45,7 +44,7 @@ const mqttMiddleware = (function () {
});
client
.
on
(
'
message
'
,
(
msgTopic
,
msg
)
=>
{
const
message
=
decoder
.
decode
(
msg
);
const
message
=
msg
.
toString
(
);
if
(
config
.
debug
)
console
.
info
(
'
MQTT: Message recieved.
\n
Topic: %s
\n
Payload: %s
'
,
topic
,
message
);
if
(
_
.
isEqual
(
topic
,
msgTopic
))
{
messages
.
push
({
topic
,
message
:
message
,
timestamp
:
new
Date
().
getTime
()});
...
...
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