Introduction
The Newbound Network is a Peer-to-Peer (P2P) framework for HTML5 web apps. The software includes an HTTP server on port 5773 and a set of default apps that provide the core Newbound Network functionality, including P2P communication, security/encryption, data storage, file transfer, port-forwarding, app publishing and much more.
HTTP
|
P2P
|
Security / Encryption
|
NoSQL Data Storage
File
Transfer
Port Forwarding
Dynamic Compilation
App Publishing
Additional Apps
|
Runtime Directory
The framework is self-contained in a single ZIP archive. Whatever folder you unzip the contents into will become your Newbound Network working directory. The Newbound Network is entirely self-contained within that folder, so you can move it later and nothing will break. Also, you can completely uninstall the Newbound Network by deleting this directory. For the purposes of this quickstart, we will refer to this folder as your "Newbound" folder. A single subdirectory of the Newbound directory called "runtime" is created to store all runtime data needed by the software. Inside the runtime directory you will find one subdirectory for each Newbound Network app installed.
Everything in the Newbound Network software is designed so that you can use as much or as little of it as you want, so
if all you need is a quick and easy web server you can just drop your files in the Newbound/html folder and they will be available at the url "
http://localhost:5773/[your file name]". Each app will also have an html folder inside of its own working directory.
Background Services
At startup, the App Manager ("botmanager") app will start up an HTTP service on the designated port (the default port is 5773), and (if enabled) a LAN discovery service on port 5772. Once these services have been initialized, the App Manager will start up each of the other apps in turn. All apps in the Newbound Network are written in HTML5 with an API of commands available via javascript. The commands are written in Java and typically return JSON responses.
The Peer Bot app will automatically establish a peer identity and attempt to connect to the Newbound Network. Once connected, you will be able to connect your device to other devices running the Newbound Network and establish exactly what apps and services you want those devices to have access to.
The software also includes an app builder called "Metabot" where you can easily just "drop in" your HTML, CSS, Javascript and Java commands, then hit "publish" and your app is immediately available to anyone you're connected to over the Newbound Network.
Deploying an app manually
The "use as little or as much as you like" and the "drop your code in here" philosophies are very important to us, so we wanted to make it as simple as possible to get started, without learning a bunch of framework stuff. If you're not interested in how the Newbound Network organizes apps under the hood, see our tutorial on
building apps with the Metabot for a faster, simpler method.
Each app in the Newbound Network is a subclass of the com.newbound.robot.BotBase class, which requires at a minimum that your app provide a unique service id and the name of your index file. You can override the "handleCommand" function to implement the commands in your app's API. At startup, the BotBase class will look for the subdirectory of "Newbound/runtime" named for its service id, and load its runtime properties from a file in that folder called "botd.properties".
Example App, "My App"
App Name: My App
Service ID: myapp001
Index File: index.html
Java File: com.mycompany.MyApp001.java (subclass of com.newbound.robot.BotBase)
App Icon: myapp001.png
The following is the minimum configuration required to get the Newbound Network to recognize your app:
Step 1 - Build Source Directory
Create a subdirectory of your
Newbound/runtime folder called
myapp001. Inside of that directory, create a subdirectory called
src. Inside of that folder, place the following files (slashes denote additional subdirectories):
com/mycompany/MyApp001.java
html/myapp001/index.html
html/myapp001/myapp001.png
NOTE: You can add as many other java or class files as you like, and any files you drop in the "html/myapp001" folder will be served up by the web server.
Step 2 - Prepare App Properties File
Now you need to create a new file called app.properties and place it in the Newbound/runtime/myapp001 folder with the following contents:
name=My App
id=myapp001
botclass=com.mycompany.MyApp001
img=/myapp001/myapp001.png
desc=The My App application
version=1
Step 3 - Activate Your App
Once those few requisite files are in place, the only thing required to activate your app is to edit the Newbound/runtime/botmanager/botd.properties file and add your class name to the end of the "bots" property. That line should look something like the following:
Step 4 - Restart the Newbound Network
Restart your instance of the Newbound Network. When your App Manager comes up, you'll have a new app on the menu.
Congratulations! You just successfully deployed an app manually on the Newbound Network!
Related Links