Shared-State

Shared data is a basic building block in MediaScape. Data synchronization is a central challenge in multi-device application, especially when shared, server-side objects may be modified at any time. A generic service is developed focusing on low update latency, quick onchange notification, consistency among observing clients as well as efficiently providing connecting clients with current state. The service is intended primarily for relatively small volumes of JSON data essential for the application.

API Description

Shared State API

Overview

Shared state solutions maintain distributed agreement concerning dynamic, online application resources in multi-device applications. Application resources may for instance include application data, context, data, or timing resources. Agreement about current state is maintained continuously, even if the resources are dynamically changing, e.g. updated frequently by connected clients.

Shared state solutions have two parts; 1) an online service and 2) a local proxy for that service. The proxy provides a local representation of the current state of the remote service and programmers may always depend on this representation being updated as soon as possible.

Shared state solution defines a high-level programming model, where distributed agents/clients interact with the application and each other - not directly - but indirectly through a common data model. This includes querying and updating shared state, as well as reacting to events as shared state changes. This programming model hides complexities regarding connection management, message-passing, discovery and pairing. Furthermore, the shared state approach encourages clients to communicate directly with servers (reliable) instead of clients (unreliable).

API Documentation

Examples

Here you can find an example of implementation:

Code example