Developing a Python Component with the Skeleton App
 
Introduction
The FFBO architecture is built on top of the Crossbario library, which means projects written in several languages will be able to communicate through the crossbar router, and interact. This allows us to develop back end solutions in Python, and interact with front end appplications in Javascript.
 
The crossbar Getting started with Python tutorial offers a good jumping off point to start developing with crossbar and python, if you want to know more.
 
We will start development with the Skeleton app, hosted on our github. This project provides the bare minimum required to get connected to the FFBO system
 
Prerequisites
  • FFBO Processor installed and running
  • Docker 
  • Python 2.7
 
Getting started
 
First, we will build on the Skeleton App, this will take away the hassle of creating a new app from scratch. I suggest you fork the repo into your own account, so that you can save you changes, but if you prefer we can just clone the repo:
 
 
This should give us a nice starting place to create our first FFBO-enabled app. 
 
Building and Deploying the Sample App
 
With this app we provide a developmental docker file, which will build and host the app, and connect to a running Processor component, with basic security (no ssl is provided by default).
 
Before we can connect to the processor component, we need to specify the url in config.py. Originally it should look like:
'ws://localhost:8080/ws'
Here localhost will need to be updated to match the IP running the processor, for example (taking care to change the port to 80801:
url = 'ws://143.124.1.23:8081/ws'
You can find your IP address using the command: 
ifconfig
 
Once this has been updated, we can first validate the and test the skeleton code using docker.
To test this setup, we can use the following two script files in the docker directory:
cd docker
sh docker_build.sh
 
A successful build should end in a message similar to this (the number will be different):
Successfully built f88cbc95670b
 
We can now run the file with:
sh docker_run.sh
Which, if successful should give you the following result:
2017-03-11T23:13:22+0000 Joined
2017-03-11T23:13:22+0000 subscribed to topic 'ffbo.server.update'
 
If you instead get the folllowing message:
2017-03-11T23:14:30+0000     raise connect_error.exception
2017-03-11T23:14:30+0000 twisted.internet.error.ConnectionRefusedError: Connection was refused by other side: 111: Connection refused.