Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
flowagent
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node-red
flowagent
Commits
1124bbbe
Commit
1124bbbe
authored
Nov 08, 2019
by
Chavee Issariyapat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
479776e2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
2 deletions
+41
-2
mqttserver.js
+40
-0
package-lock.json
+0
-0
package.json
+1
-2
No files found.
mqttserver.js
View file @
1124bbbe
module
.
exports
.
create
=
create
const
Mosca
=
require
(
'mosca'
);
const
events
=
require
(
'events'
);
const
MQTTServer
=
function
(
param
=
{})
{
this
.
param
=
param
;
}
MQTTServer
.
prototype
=
new
events
.
EventEmitter
;
MQTTServer
.
prototype
.
start
=
function
()
{
let
that
=
this
;
this
.
mqttserver
=
new
Mosca
.
Server
({
port
:
this
.
param
.
port
,
host
:
this
.
param
.
host
});
this
.
mqttserver
.
on
(
'ready'
,
function
()
{
console
.
log
(
`FlowAgent MQTT is up and running at
${
that
.
param
.
port
}
`
);
});
this
.
mqttserver
.
on
(
'clientConnected'
,
function
(
client
)
{
console
.
log
(
'client connected'
,
client
.
id
);
});
}
// MQTTServer.prototype.xxx = function(topic, payload) {
// }
function
create
(
param
)
{
return
new
MQTTServer
(
param
);
}
package-lock.json
View file @
1124bbbe
This source diff could not be displayed because it is too large. You can
view the blob
instead.
package.json
View file @
1124bbbe
...
...
@@ -15,7 +15,7 @@
"dependencies"
:
{
"
config
"
:
"^3.2.4"
,
"
dotenv
"
:
"^8.2.0"
,
"
mosca
"
:
"^2.8.3"
,
"
mqtt
"
:
"^3.0.0"
}
}
\ No newline at end of file
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