Jump to: navigation, search

Difference between revisions of "RAP/Server Push"

< RAP
(New page: The UICallBack is RAP's mechanism to push UI-changes to the client. It's based on the so-called [http://en.wikipedia.org/wiki/Comet_(programming) Comet] approach, i.e. it uses a long-stand...)
 
Line 1: Line 1:
The UICallBack is RAP's mechanism to push UI-changes to the client.
+
The UICallback is RAP's mechanism to push UI-changes to the client.
 
It's based on the so-called [http://en.wikipedia.org/wiki/Comet_(programming) Comet] approach, i.e. it uses a long-standing request that is answered only in case of server-side updates.
 
It's based on the so-called [http://en.wikipedia.org/wiki/Comet_(programming) Comet] approach, i.e. it uses a long-standing request that is answered only in case of server-side updates.
  
There are two different types of requests involved
+
=== Requests ===
 +
There are two different types of requests involved:
  
 
==== UI requests ====
 
==== UI requests ====
Line 14: Line 15:
 
=== Activation ===
 
=== Activation ===
  
The UICallBack mechanism is activated and deactivated on the server.
+
The UICallback mechanism is activated and deactivated on the server.
 
When the activation state changes, the property uiCallbackActive is updated in the response of a ui request.
 
When the activation state changes, the property uiCallbackActive is updated in the response of a ui request.
  
Line 36: Line 37:
 
The following actions cause a standing callback request to be responded to.
 
The following actions cause a standing callback request to be responded to.
  
==== Display#wake ====
+
==== Display#wake() ====
  
 
causes the request to return true (only if outside of a ui request)
 
causes the request to return true (only if outside of a ui request)

Revision as of 09:25, 19 July 2011

The UICallback is RAP's mechanism to push UI-changes to the client. It's based on the so-called Comet approach, i.e. it uses a long-standing request that is answered only in case of server-side updates.

Requests

There are two different types of requests involved:

UI requests

Normal Ajax requests that synchronize client and server.

Callback requests

Long-standing Ajax requests for server notifications to the client.

Activation

The UICallback mechanism is activated and deactivated on the server. When the activation state changes, the property uiCallbackActive is updated in the response of a ui request.

When the property uiCallbackActive is true, the client ensures that there is an active connection to the server.

Callback requests

  • After processing the response to a ui request, the client sends a new callback request if the uiCallbackActive property is true and there is no current callback request standing.
  • When a callback request fails, the client sends a new callback request to re-establish the broken callback connection. To avoid unnecessary load on the client, retry requests are sent with a suitable delay.
  • In the response to a callback request, the server tells the client whether a ui request is needed.

Possible answers are true and false. If the answer is true, the client sends a normal ui request to the server.

Because every ui request must synchronize client and server, this ui request must contain any pending changes on the client. This request does not differ from requests that are sent as a result of a user interaction.

API Calls that affect the UI Callback

The following actions cause a standing callback request to be responded to.

Display#wake()

causes the request to return true (only if outside of a ui request)

Display#(a)syncExec()

causes the request to return true if no ui request is running. If a ui request is currently running, the (a)sync runnable are being processed by this ui request. In this case, the callback request is not released

UICallBack#deactivate()

causes the request to return false if no other instance requires the UICallBack system