Connecting to the FFBO with Python
WARNING: This Tutorial is OUT OF DATE, we suggest you use the latest tutorial +here
 
This will be left for educational purposes only. Continue at your own peril
 
WARNING: This Tutorial is OUT OF DATE, we suggest you use the latest tutorial +here
 
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. We will base our first component of the "hello.py" example.
 
Prerequisites
  • FFBO Processor installed, and running local ssl
  • Crossbario installed either locally or in a docker
  • Python 2.7
 
Getting started
 
In a clean directory, we will start by initialising a new crossbar app, using the automatic crossbar functions. This will create a good skeleton of an app to start with:
 
crossbar init --template hello:python --appdir ./ffboApp
 
If you navigate to that directory, with "cd ffboApp", you should see the following files:
  • hello.py
  • README.md
  • web/
 
If you want to test the project, we can by typing 
crossbar start
Into the command line, if you already have a crossbar instance running, this will likely cause an error, as they will both attempt to bind to the same address for the web front end, port 8080.
 
This should give us a nice starting place to create our first FFBO-enabled app. 
 
Connecting to the FFBO architecture
 
By default, the new project, called hello, includes something called a WAMP router. This piece of software routes all the communications between the various components. 
 
In this case, we do not want to use the default router, as we want to be able to communicate with the already running FFBO router, contained within the Processor Component.
 
This information is stored in the config.json file, in the .crossbar folder. That "." before crossbar is very important, as it indicates a hidden folder in Linux.
 
we can edit that file in gedit using:
 
gedit .crossbar/config.json
 
We can delete it all, and replace it with:
 
{
    "version": 2,