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
20e8460a
Commit
20e8460a
authored
Dec 14, 2019
by
Chavee Issariyapat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add flowagent.js
parent
793014f7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
flowagent.js
+37
-0
No files found.
flowagent.js
0 → 100644
View file @
20e8460a
module
.
exports
.
create
=
create
const
MQTTClient
=
require
(
'./mqttclient'
);
const
MQTTServer
=
require
(
'./mqttserver'
);
const
Coordinatior
=
require
(
'./coordinator'
);
const
events
=
require
(
'events'
);
let
FlowAgent
=
function
(
options
)
{
let
that
=
this
;
this
.
remoteclient
=
MQTTClient
.
create
({
host
:
options
.
remote_broker_uri
,
options
:
{
clientId
:
options
.
flowagent_id
,
username
:
options
.
flowagent_username
,
password
:
options
.
flowagent_password
,
keepalive
:
30
}
});
this
.
localserver
=
MQTTServer
.
create
({
host
:
options
.
localBrokerURI
.
hostname
||
'0.0.0.0'
,
port
:
parseInt
(
options
.
localBrokerURI
.
port
)
||
1883
});
this
.
coordinatior
=
Coordinatior
.
create
({
remoteclient
:
that
.
remoteclient
,
localserver
:
that
.
localserver
});
}
FlowAgent
.
prototype
=
new
events
.
EventEmitter
;
FlowAgent
.
prototype
.
start
=
function
()
{
this
.
coordinatior
.
start
();
}
function
create
(
options
)
{
return
FlowAgent
(
options
);
}
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