UDPPush
From Open-Xchange
UDP Push
Introduction
This document defines the Open-Xchange UDP Push protocol which is used to send events to registered clients and servers.
Low level Documentation
A package is a number of tokens. The tokens are strings, numbers or boolean values and every token is seperated with a '\1'.
Protocol
Client Register Package
| Name | Type | Descrption |
|---|---|---|
| Magic int | Number | Static value: 1337 |
| Package Length | Number | The length of informations in this package |
| Action | Number | For a client register package the action value is always '1' |
| User ID | Number | The user id |
| Context ID | Number | The context id of the user |
Java Example
public static final int MAGIC = 1337;
public static final int REGISTER_ACTION = 1;
protected int userId = 1234; // read userId from config
protected int context = 5678 // read context from config
StringBuffer packageData = new StringBuffer();
packageData.append(REGISTER_ACTION);
packageData.append('\1');
packageData.append(userId);
packageData.append('\1');
packageData.append(contextId);
packageData.append('\1');
StringBuffer stringPackage = new StringBuffer();
stringPackage.append(MAGIC);
stringPackage.append('\1');
stringPackage.append(packageData.length());
stringPackage.append('\1');
stringPackage.append(packageData);
// send the value of stringPackage
The response of a client register package request is only "OK\1'
Push Package
| Name | Type | Descrption |
|---|---|---|
| Folder ID | Number | The folder id where an event occured |
Internal Register Sync Package
| Name | Type | Descrption |
|---|---|---|
| Magic int | Number | Static value: 1337 |
| Package Length | Number | The length of informations in this package |
| Action | Number | For a client register package the action value is always '2' |
| User ID | Number | The user id |
| Context ID | Number | The context id of the user |
| Address | String | The address of the user who has registered |
| Port | Number | The port of the user who has registered |
Java Example
public static final int MAGIC = 1337;
public static final int INTERNAL_REGISTER_ACTION = 2;
protected int userId = 1234; // read userId from config
protected int context = 5678 // read context from config
StringBuffer packageData = new StringBuffer();
packageData.append(INTERNAL_REGISTER_ACTION);
packageData.append('\1');
packageData.append(userId);
packageData.append('\1');
packageData.append(contextId);
packageData.append('\1');
StringBuffer stringPackage = new StringBuffer();
stringPackage.append(MAGIC);
stringPackage.append('\1');
stringPackage.append(packageData.length());
stringPackage.append('\1');
stringPackage.append(packageData);
// send the value of stringPackage
Internal Push Sync Package
| Name | Type | Descrption |
|---|---|---|
| Magic int | Number | Static value: 1337 |
| Package Length | Number | The length of informations in this package |
| Action | Number | For a client register package the action value is always '3' |
| Folder ID | Number | The folder id where the event occured |
| Module | Number | The Id of the module:
Appointment = 1 Task = 4 Contact = 7 EMail = 19 Folder = 20 |
| Context ID | Number | The context id of the user |
| Users | String | All user id who are affected by this event seperated with a comma. |
Remote Host Register
| Name | Type | Descrption |
|---|---|---|
| Magic int | Number | Static value: 1337 |
| Package Length | Number | The length of informations in this package |
| Action | Number | For a remote host register the action value is always '4' |
| Hostname | String | The hostname of the registering server |
| Port | Number | The port of the registering server |
Java Example
public static final int MAGIC = 1337;
public static final int REMOTE_HOST_REGISTER = 4;
/*
* The server name of registering application
*/
protected String hostname = "yourserver.tux"; // server
/*
* The port of the of the registering application.
* The port where your application is listening
*/
protected int port = 12345; // port
StringBuffer packageData = new StringBuffer();
packageData.append(INTERNAL_REGISTER_ACTION);
packageData.append('\1');
packageData.append(hostname);
packageData.append('\1');
packageData.append(port);
packageData.append('\1');
StringBuffer stringPackage = new StringBuffer();
stringPackage.append(MAGIC);
stringPackage.append('\1');
stringPackage.append(packageData.length());
stringPackage.append('\1');
stringPackage.append(packageData);
// send the value of stringPackage