- Technical documentation
- API docs
Sandboxed applications and spacelets (apps) can be run in so called develop mode (a.k.a. debug mode). In develop mode the apps are not running inside sandboxed environment and possibilities to debug the apps are better. App developers are free to come up with their own debugging methods by utilizing the freedom from the sandboxed environment enables. As an example and suggestion, use the output to the console to see printing in realtime (no more studying log files).
The develop mode can be utilized quite flexibly but for it to work the app must be installed on the edge. So, before trying the develop mode build the basic framework of the applications and install it to the edge. Apps can be installed normally to the edge or they can be installed specifically in develop mode. The develop mode installation is a lightweight installation where the sandboxed environment (Docker container) is not created for the app. It is therefore not possible to run develop mode installation like the normal installation can be (e.g. with the spm run command). Install app to the edge in develop mode like this.
spm install develop <package>
After the application is installed it can be run in develop mode simply by changing to the applications directory and by starting the application manually. If the installation of the app is done normally, remeber to stop the app before trying to run it in the develop mode. Execute
spm stop <unique_name>
if the app is running.
One prerequisite for the develop mode is to make sure that the Spaceify API's SpaceifyApplication module is loaded in the app like this.
var spaceify = require("/var/lib/spaceify/code/spaceifyapplication.js");
After all the conditions listed above are met, try to start the application in the develop mode. Below is an example.
$ cd /var/lib/spaceify/data/sandboxed/spaceify/eventchannel/volume/application $ node eventchannel.js
After Spaceify has initialized the application, the output to the console could be something like this. In the printout some of the lines are printed by Spaceify and some of them are printed by the app.
[i] WebSocketServer::listen() protocol: ws, subprotocol: json-rpc, hostname: null, port: 0 [i] WebSocketServer::listen() protocol: wss, subprotocol: json-rpc, hostname: null, port: 0 LISTEN -----> spaceify.org/services/eventchannel - port: 42527, secure port: 36341 LISTEN -----> http - port: 37994, secure port: 36901 EventChannel::start() EventChannel::start() got provided service EventChannel::start() rpc methods exposed EventChannel::start() end *** application initialized --- spaceify/eventchannel [i] WebSocketServer::request(42527) protocol: ws, remoteAddress: ::ffff:172.17.0.4, remotePort:-, origin:-, id: 19030827 [i] WebSocketServer::request(36341) protocol: wss, remoteAddress: ::ffff:172.17.0.4, remotePort:-, origin:-, id: 3064669479 [i] WebSocketServer::request(42527) protocol: ws, remoteAddress: ::ffff:172.17.0.2, remotePort:-, origin:-, id: 272386892 [i] WebSocketServer::request(36341) protocol: wss, remoteAddress: ::ffff:172.17.0.2, remotePort:-, origin:-, id: 2612632193