-
Notifications
You must be signed in to change notification settings - Fork 46
Admin API
This document describes the API for communications between an Admin app and the Spacebrew server. All communications are sent in json format. There are several different types of communications that take place between these two entities:
Register Admin App
New Client App Connected or Existing Client Updated
Client App Disconnected
Route Added
Route Removed
Data Published
Current Admin API Version: 0.2
Message that is sent by Admin apps to Spacebrew server to identify itself as an Admin app. This message is also forwarded by the Spacebrew server to all connected Admins apps.
The attribute no_msgs
is optional. It enables an Admin app to notify the Spacebrew server to refrain from forwarding data publish
. By default the Spacebrew server does forward data publish
messages to all Admin apps.
{
"admin":[
{
"admin": true,
"no_msgs": true
}
]
}
Message that is forwarded from Spacebrew server to Admin clients. It has the same format as the Client app connection message from the Client API, except that it also features a remoteAddress
attribute that can be used to differentiate between clients with the same name.
{
"config": {
"name": "APP NAME",
"description":"APP DESCRIPTION",
"publish": {
"messages": [
{
"name":"PUB NAME",
"type":"DATA TYPE",
"default":"DEFAULT VALUE (OPTIONAL)"
}
]
},
"subscribe":{
"messages":[
{
"name":"SUB NAME",
"type":"DATA TYPE"
},
]
},
"remoteAddress":"127.0.0.1"
}
}
Message that is sent from Spacebrew server to Admin apps when a Client app disconnects from the Spacebrew server.
{
"remove":[
{
"name":"app_two",
"remoteAddress":"127.0.0.1"
}
]
}
Message that is sent by Admin apps to Spacebrew server to create routes. The same message is sent from the Spacebrew server to all Admin apps, so that they can accurately display all active routes.
{
"route":{
"type": "add",
"publisher":{
"clientName": "APP NAME",
"name": "PUB NAME",
"type": "DATA TYPE",
"remoteAddress": "APP IP ADDRESS"
},
"subscriber":{
"clientName": "APP NAME",
"name": "SUB NAME",
"type": "DATA TYPE",
"remoteAddress": "APP IP ADDRESS"
}
}
}
Message that is sent by Admin apps to Spacebrew server to remove existing routes. The same message is sent from the Spacebrew server to all Admin apps, so that they can accurately display all active routes.
{
"route":{
"type": "remove",
"publisher":{
"clientName": "APP NAME",
"name": "PUB NAME",
"type": "DATA TYPE",
"remoteAddress": "APP IP ADDRESS"
},
"subscriber":{
"clientName": "APP NAME",
"name": "SUB NAME",
"type": "DATA TYPE",
"remoteAddress": "APP IP ADDRESS"
}
}
}
If a route is removed because a client has disconnected from the server, then the message is slightly modified. The modified message features an extra attribute titled client_disconnect
. This information is used by the live persistent router service, which ignores messages with the client_disconnect flag.
{
"route":{
"type": "remove",
"client_disconnect": true,
"publisher":{
"clientName": "APP NAME",
"name": "PUB NAME",
"type": "DATA TYPE",
"remoteAddress": "APP IP ADDRESS"
},
"subscriber":{
"clientName": "APP NAME",
"name": "SUB NAME",
"type": "DATA TYPE",
"remoteAddress": "APP IP ADDRESS"
}
}
}
Message that holds the data that is being sent by a publisher. This message features all of the content from the data messages that are sent to the Spacebrew server by a publisher, plus the remoteAddress
and clientName
attributes.
{
"message":{
"clientName":"APP NAME",
"name":"PUB NAME",
"type":"DATA TYPE",
"value":"VALUE",
"remoteAddress":"APP IP ADDRESS"
}
}