Skip to content

CHI2013/interactive-schedule

Repository files navigation

glance

Description

glance is the back-end for the new CHI2013 papers-at-a-glance system.

Installing and running

You'll need node.js, CoffeeScript and CouchDB to run the server. You will also need the CHI2013 program data. The CHI2013 program data should be extracted into bootstrap_scripts/json

Run 'npm install' in the root of glance Now go to the folder 'bootstrap_scripts' and run

sh bootstrap.sh

To compile the (now very simple client code) in the root of glace run 'cake build'

Change the config.json to point at the right database in CouchDB

NOW you can run the server by from the glance root:

coffee glance.coffee config.json

The server will now run on http://localhost:8000

If you just browse there nothing will happen but http://localhost:8000/session should dump all sessions.

You can see a bit of interaction if you browser to http://localhost:8000/phone.html and look at the javascript console output. (The functionality of mobile.html is implemented in phone.coffee). If you post a new filter

curl -X POST http://localhost:8000/filters -H "Content-Type: application/json" -d '{"authorKeywords": ["visualization", "infoviz"]}'

Usage

The glance server provides a basic REST based API.

###Central concepts and API

###Events The glance server uses socket.io to send messages to the client. Import the socket.io script (when HTML is served from node.js)

<script src="/socket.io/socket.io.js"></script>

To connect

var socket = io.connect("http://"+window.location.hostname, {port: 8000});

Now it is possible to listen to the following events

  • tilesUpdated: is called whenever a new filter is applied to the server
  • tick: is called with a configurable time interval and used to synchronise the "slideshows" of the displays. The data given with the tick event is an integer with the tick count.

Example:

socket.on('tick', function(count) {
    console.log("Tick " + count;)
});

socket.on('tilesUpdated', function(data) {
    $.get('/tiles', function(tiles) {
        console.log("Filters updated!");
        console.log(data);
    });
});

Mobile Interface

The main file for the mobile interface is located under glance/mobile/phone.html

Once the server is running you can use it to post filters and view submissions related to them.

Once submissions are being display, a tap event on the tile triggers the function to send the selected submission ID to the future Obj-C function to add to the schedule on the iOS app.

function addSubmission(id){
    alert("called iOS");
}

As explained here https://developer.apple.com/library/mac/#documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/ObjCFromJavaScript.html#//apple_ref/doc/uid/30001215-BBCBFJCD , we should use this function to communicate both apps.

Currently it only offers "add" capabilities but more will come in the future.