Javascript for windclocks

Working meetings


Every Wednesday, 16:00 on freenode.net #tik

Needed pre-info


TAK server und json protokoll (updated!)

some info on MACs of Clocks

XEP-0060: Publish-Subscribe

Server Requirements

Browsers don't support a built-in support for XMPP protocol. However you can tunnel XMPP sessions over HTTP connections using HTTP long polling. XMPP server (Openfire in our case) has a built-in support for HTTP-managed connections called BOSH (Bidirectional streams Over Synchronous HTTP).

Openfire BOSH Configuration

initial planning


Minimum demand

  • a clean .js for implementing into a webpage
  • a downloadable bar for one/two popular browsers (easy implement)


Maximum demand

  • an alarm clock
  • implementation perfectionized for drupal
  • during the Art Radio September Event that the streams as well are shown on the bar, so that people can tune in, when there is a show.

Implementation


Development is based on Strophe.js - An XMPP library for JavaScript. It's in active development, has a pubsub plugin and good documentation. Check out the book: Professional XMPP Programming with JavaScript and jQuery.

Openfire limitations
Anonymous subscriptions to pubsub nodes aren't possible with Openfire so we have to define a user (“js”?) which is used to subscribe to clocks. (see http://community.igniterealtime.org/message/194575#194575)

dependencies

  • Strophe Javascript library
  • Strophe pubsub plugin
  • flXHR
  • jquery

Code


Get the code from subversion: http://code.okno.be/trac/tiks/browser/jsclient
Get the code as zip: http://go.yuri.at/tikclient/tikclient.zip

You can check out a working version here: http://go.yuri.at/tikclient/tikclient.html
Check out debug version to see traffic between Openfire pubsub service and JS client: http://go.yuri.at/tikclient/tikclient.debug.html

Communication

  1. Establish connection to pubsub.tik.okno.be with jid tester@tik.okno.be
  2. Retrieve all clocks
  3. Subscribe to all clocks
  4. Update clock info when node gets actualized


Info from clocks

so-onOne: 17098 { slope: -1 (float) | orientation: 763 (float) | } Thu Jul 21 2011 22:54:26 GMT+0200 (CET)
clockName: tik  { metainfo: value (format) | ... }                  datetime of last update

todo

  • avoid flXHR: Openfire doesn't support Cross-Origin Resource Sharing (CORS) so we depend on flXHR.
  • update to actual jquery version
  • document code
  • firefox/chrome extension
  • javascript library for use with Processing.js

Resources

 
windclocks/javascript.txt · Last modified: 2011/07/25 15:17 by geraldo
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki