Interface Module

Description

Interface module defines various mechanisms used for communication with clients. Among these are:

Channel
abstract class representing a specific client functionality used by server, like multi-touch, sensors, sound, menus.
Client
class representing a client. It contains a set of attached channels.
Event
each event type (mouse, touch, translate, rotate, orientation) inherits from this type. Events are processed by Processors.
Processor
typically processes one kind of event into another, filters them or modifies in other way. Processors may be organized in a flow net structure.

Protocol

The module also defines the communication protocol used for all Vitrall clients.

The protocol is currently text based and several message types exist. They are distinguished by their first token. Wherever JSON object is send, it is advised to use a compact form, i.e. without any whitespaces, in order to save the bandwidth.

Configuration Message

The first thing the client must do after establishing the Web Socket connection is to send a configuration message:

config <JSON configuration object>

JSON configuration object example:

{
    "clientId": "87901687-43e6-4ff6-a89b-90bf530e6b8d",
    "capabilities": {
        "display": {
            "resolution": { "x": 800, "y": 600 },
            "compressions": [ "JPEG", "PNG", "JPEG-PNG" ]
        },
        "vibration": true,
        "sound": true,
        "orientation": true        
    },
    "properties": {
        ... // Scenario specific stuff, e.g. EStore
    }
} 

Channel Message

This message type can be used in both directions. It transfers data between Interface::Channel instance on the server side and its realization on the client. Token <channel-id> is an unique channel identifier (integer). Content is specific for channel type.

channel <channel-id> <content>

For example a message from client to server could look like this:

channel 15 move 54 129

This message would be routed to Channel instance identified by number 15, presumably of type Mouse::Analyser, which would then parse the remainder of the message, construct event of type Mouse::MoveEvent with position [54, 129] and pass this event down the processors chain.