void SliderSenderApp::setup()
{
    string host = Spacebrew::SPACEBREW_CLOUD;
    string name = "cinder-range-example";
    string description = "Sends three range signals";
    
    mSpacebrew = Spacebrew::Connection::create( host, name, description );
    mSpacebrew->addPublish("red", Spacebrew::TYPE_RANGE);
    mSpacebrew->addPublish("green", Spacebrew::TYPE_RANGE);
    mSpacebrew->addPublish("blue", Spacebrew::TYPE_RANGE);
    
    mSpacebrew->connect();
    
    int count = 0;
    //  initialize booleans and offsets to false and zero; set positions
    for (auto &button : mSliderButtons) {
        button.isSelected = false;
        button.offset = 0;
        button.pos.x = ci::app::getWindowWidth() / 2;
        button.pos.y = (ci::app::getWindowHeight() / 4) + (count * ci::app::getWindowHeight() / 4);
        count++;
    }
    
    //  set colors to red, green, and blue
    mSliderButtons[0].color = ci::Color(1, 0, 0);
    mSliderButtons[1].color = ci::Color(0, 1, 0);
    mSliderButtons[2].color = ci::Color(0, 0, 1);
    
    //  keep track of name of each one
    mSliderButtons[0].name = "red";
    mSliderButtons[1].name = "green";
    mSliderButtons[2].name = "blue";
    
    mRadius = 25;
}
void Template::setup()
{
    
    string host = "sandbox.spacebrew.cc"; // change to localhost to test Spacebrew local server
    string name = "cinder-example";
    string description = "It's amazing";
    
    spacebrew = Spacebrew::Connection::create( this, host, name, description );
    
    spacebrew->addSubscribe("backgroundOn", Spacebrew::TYPE_BOOLEAN);
    spacebrew->addPublish("cinder-mouse", "boolean", "false");
    
    spacebrew->connect();
    
    spacebrew->addListener( &Template::onMessage, this);
    
    myColor = Color(0,0,0);
}
void SliderSenderApp::sendSliderValue(string name, float value)
{
    //  range values are integers from 0 to 1023
    int mappedValue = lmap<int>(value, 50, ci::app::getWindowWidth() - 50, 0, 1023);
    mSpacebrew->sendRange(name, mappedValue);
}
void Template::mouseUp( MouseEvent event )
{
    spacebrew->sendBoolean("cinder-mouse", false);
}
void Template::mouseDown( MouseEvent event )
{
    spacebrew->sendBoolean("cinder-mouse", true);
}