Getting started with Mobile JavaScript

Reading time ~1 minute

For the Firefox Open App Days I wrote a chat demo to introduce various technologies for mobile Apps including a native iPhone application created with Apache Cordova, an HTML5 App for the brand new Firefox OS and a HTML5 web site for mobile Browsers. To broadcast chat messages between users, socket.io is used. The source code can be downloaded and forked from GitHub: OpenAppChat.

To run the demo, you just need node.js installed on your computer. In your Terminal, cd to the OpenAppChat directory and run:

node app.js

Navigate with your web browser of choice to http://localhost:3000 to see the chat. Inside your local network, you might need to figure out your local IP and change the corresponding JavaScript files to access this IP:

iOS: iOS-OpenAppChat/www/js/index.js
Firefox OS: fOS-OpenAppChat/www/js/lib/app.js

Change:

io.connect('http://192.168.0.1:3000');

I can also recommend to have a look at nodejitsu, those guys are doing a pretty good job in hosting node.js applications, so you can just change the file package.json, change the subdomain and run

jitsu deploy

to deploy the app to your account. To run one of the apps, change the socket.io connect line to your nodejitsu subdomain which you can specify in package.json.

To install the Firefox OS App in the simulator or on a device, go to the directory and run volo serve.

Feel free to modify the code and please share your experience and learnings with the community.

Europe on Two Wheels

![Iron 883](/images/2015/07/IMG_7368.jpg)## Barcelona (Spain) - Le Dramont, Cote d'Azur (France)> 648km![Le Dramont](/images/2015/07/IMG_...… Continue reading

Updates!

Published on September 10, 2014

HTML5 vs. Native [thoughts]

Published on February 26, 2014