Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Demo for creating a communication channel between a web app and an iOS device

tree: c31995d581

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 SensorConnect
Octocat-spinner-32 sensor_connect_client removed code and updated readme June 10, 2012
Octocat-spinner-32 sensor_connect_server
Octocat-spinner-32 .gitignore


This is a simple demo using node.js and Cordova (PhoneGap) to create a communication channel between an iOS device and a web application. The example demonstrates how to send iOS sensor data and custom messages to a web application and how to send commands from the web app to the iOS device.

Currently this demo only works for iOS devices. It could be made to work with Android as well if you add a Cordova websocket plugin for Android. I just don't have an Anroid device to test with.


Install and setup node.js and the required npm modules (note that the modules are not included in the distribution so you'll need to install them yourself):

  1. Install node.js if you have not already.
  2. Install the following npm modules. Navigate to Sensorconnect/sensor_connect_server in your terminal:
  3. type: 'npm install websocket' and hit enter
  4. type: 'npm install websocket-server' and hit enter
  5. type: 'npm install express' and hit enter

If you have trouble and are unfamiliar with node.js and npm, please read up on those topics.

Install and setup Cordova (PhoneGap):

  1. Download and install Cordova (PhoneGap) (This demo is using Cordova 1.8.0)
  2. Follow the Cordova setup instruction for iOS (use the instruction in the download, not the Cordova website because it's typically out of date).
  3. Change line 55 of main.js to the hostname of your computer. You can alternatively use the IP address of you're computer but the hostname is better if you're using a mac since your IP address could change.
  4. Open the SensorConnect XCode project and compile for you iOS device.

If this is your first time using Cordova (PhoneGap) first make sure you can run the Cordova demo application before trying to run this demo.


Once node.js and Cordova are installed and setup you can run the demo:

  1. Open Terminal and navigate the SensorConnect/sensor_connect_server/
  2. Type 'node server.js' to startup the server (you should see 'Server is listening on port 8080' if successful).
  3. Open SensorConnect/server_connect_client in your browser (I've only tested with Chrome... should also work in Firefox and Safari)
  4. Open SensorConnect on your iOS device (either directly if you've already installed it, or run it via Xcode)
Something went wrong with that request. Please try again.