Skip to content
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:

  1. Connect Client App to Spacebrew Server
  2. Send Data Between Client App and Spacebrew Server

Connect Client App to 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"
                },
            ]
        }
    }
}

Send Data Between Client App and Spacebrew Server

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",
    }
}