State Exchange

State Exchange is a software system that enables the extraction and restoration of the state of applications into persistent containers. These application state containers can be used to migrate applications across different devices and platforms while preserving their state. For example, a text editor can be migrated from a desktop computer to a Smartphone without changing the current cursor position.


State Exchange is released as open source under the MIT license. The source code is available at GitHub.


How does it work?


Each device that should participate in State Exchange must run the State Exchange Service.
This service can access the state of supported applications through the State I/O protocol.
Users interact with the service through clients that communicate with one or more State Exchange Services through the State Exchange protocol.


To integrate support for State Exchange into an application, the application must be extended to implement the State I/O protocol. This protocol contains two commands to extract and restore the state into a predefined container format. In addition, State I/O defines mechanisms to observe the state of an application.


Getting Started


To start using State Exchange, install the State Exchange Service on every device that you intend to use. Then, implement support for State I/O in each application that you want to use for State Exchange. Finally, install the standard client or implement your own client to adapt how and when state exchange is performed.


State Exchange Service


The State Exchange Service is requires node.js. After installing node.js, install the required packages through npm by by running npm install. Then, simply start the service by running node app.

The service starts two servers listening on port 50000 (State Exchange) and 50001 (State I/O).


State I/O Support for Applications


To implement support for State Exchange into an application, the application must connect to the State Exchange service upon launching and keep the connection open. All messages between the service and the application are exchanged using \0-terminated JSON objects. For a detailed description of the State I/O protocol, please refer to my dissertation linked at the bottom or the included sample code.

For Mac OS X applications, you can use the included framework to implement the communication with the State Exchange service and instead implement delegate methods to customize the state extraction and restoration. Please see the example applications for detailed instructions on how to use the framework.


Clients for State Exchange


Clients can connect to the State Exchange service running on any device at any time and request a list of running applications or trigger state operations. Similar to State I/O, all messages are exchanged as \0-terminated JSON objects. For a detailed description of the protocol please refer to the example client.

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.