Skip to content
Justin Parker edited this page Jul 18, 2019 · 5 revisions

Simple example

Discovery

Client multicasts:

{ "discovery": "*", "types": ["tcp", "http"] }

Server replies (unicasts) back:

{ "present": ["Node X", "Node Y", "Node Z"], 
  "addresses": ["tcp://192.168.2.10:60223", "http://192.168.2.10:8085/nodes/%NODE%/"] }

Connection

Client creates TCP connection to 192.168.2.10:60223.

Client sends:

{ "node": "Node X", 
  "actions": [ "Action A", "Action B", "Action C" ],
  "events": ["Event R", "Event S", "Event T" ] }

Server confirms with:

{ "node": "Node X", 
  "actions": [ "Action A", "Action B", "Action C" ],
  "events": ["Event R", "Event S", "Event T" ] }

Operation

Client calls Action A:

{ "node": "Node X", "action": "Action A", "arg": 0 }

Clients waits for events...

Server sends:

{ "node": "Node X", "event": "Event R", "arg": true }
{ "node": "Node X", "event": "Event S", "arg": [1, 2, 3] }

Names

See https://github.com/museumsvictoria/nodel/wiki/Simple-names