|
|
@ -419,10 +419,22 @@ composer require guzzlehttp/guzzle |
|
|
|
|
|
|
|
== IoT Server |
|
|
|
|
|
|
|
.Imaging a swarm |
|
|
|
image:./Swarming2.gif[alt="Swarm"] |
|
|
|
|
|
|
|
|
|
|
|
.Architecture of swarm communication |
|
|
|
image:./Swarming2.gif[alt="Swarm Gateway"] |
|
|
|
|
|
|
|
- Red Note: Sensor Node and Gateway Role |
|
|
|
- Black and Red Note: Sensor Node - Client |
|
|
|
|
|
|
|
=== NodeJS |
|
|
|
|
|
|
|
==== Gateway |
|
|
|
|
|
|
|
Gateway forwards ore Client Data to the correct application - Server |
|
|
|
|
|
|
|
.NodeJS code in Raspberry Pi - Server Gateway |
|
|
|
[source,c] |
|
|
|
---- |
|
|
@ -489,7 +501,12 @@ app.listen(9089, function () { |
|
|
|
|
|
|
|
---- |
|
|
|
|
|
|
|
==== Broadcast |
|
|
|
==== Server - Broadcast |
|
|
|
|
|
|
|
|
|
|
|
Broadcast data to swarm clients |
|
|
|
|
|
|
|
The server receives data from its client and echoes its back. |
|
|
|
|
|
|
|
.NodeJS code in Raspberry Pi - Server broadcast |
|
|
|
[source,c] |
|
|
@ -542,6 +559,9 @@ io.on('connection', (socket) => { |
|
|
|
|
|
|
|
==== Client Connection Raspberry |
|
|
|
|
|
|
|
Swarm client recieves data |
|
|
|
|
|
|
|
|
|
|
|
.NodeJS code in Raspberry Pi - Client |
|
|
|
[source,c] |
|
|
|
---- |
|
|
|