Skip to content
Roman Rädle edited this page Apr 9, 2015 · 2 revisions

Huddle JavaScript API

An instance of Huddle handles the connection to a Huddle engine through a web socket connection. It offers properties to automatically reconnect on connection errors. The device will get a continues stream of proximity data if a connection to Huddle engine is established.

var huddle = Huddle.client({
    name: "MyHuddleDevice",            // name is optional
    glyphId: "1"                       // glyphId is optional and should only be used for debugging purposes
})
.on("proximity", function (data) {
    console.log(data);
})
.on("message", function (data) {
    console.log(data);
});
huddle.connect("orbiter.huddlelamp.org", 1948);

The proximity data update looks like this:

{
  Type: "TYPE",               // a string e.g., Display or Hand
  Identity: "IDENTITY",       // a string that represents the Huddle id
  Location: double[3],        // values are [0;1], Location[0] = x, Location[1] = y, Location[2] = z
  Orientation: double,        // value is [0;360]
  Distance: double,           // value is [0;1] and only set for presences in Presences property.
  Movement: double,           // not yet implemented
  Presences: Proximity[],     // array of proximities, which essentially have the same properties as this object (except Presences is empty)
  RgbImageToDisplayRatio: {
                            X: double,
                            Y: double
                          },
}
Clone this wiki locally