-
Notifications
You must be signed in to change notification settings - Fork 46
Client API
adenine edited this page Jul 11, 2013
·
7 revisions
This document describes the API for communications between a Client app and the Spacebrew server. All communication is sent in json format. There are two different types of communications that take place between these two entities:
Connect Client App to Spacebrew Server
Send Data Between Client App and Spacebrew Server
To connect a Client app to the Spacebrew server the Client app sends a configuration message once the websockets connection has been established. The syntax for these messages should follow the structure defined below. This message includes the app's name, description, publishers and subscriptions.
{
"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"
},
]
}
}
}
Data is sent from Client apps to the Spacebrew server, and back, using the simple message format defined below. These messages include the subscriber or publisher name, data type and data value.
{
"message":{
"clientName":"CLIENT NAME (Must match the name in the config statement)",
"name":"PUBLISHER NAME (outgoing messages), SUBSCRIBER NAME (incoming messages)",
"type":"DATA TYPE",
"value":"VALUE",
}
}