The Client Communication Engine enbables the client side web control to send control signals to its server side. If the signal changes any web control, the server responds with one or more change objects. The Client Communication Engine updates the client UI accordingly.
Overview
This page describes the Client Communication Engine process.
See also the following page for background information:
-
The Web Document
The web document is a node tree on the server. When rendered, it translates the document model into a rendered web document that can be visualized in a web browser.
The Process
The following flow chart below displays the Client Communication
Engine process. Blue boxes indicate JavaScript functions. Red
boxes correspond to web service calls:
serverCall
A web control providing user interaction attaches this function
as the event handler to an event, for instance a mouse click.
It wraps the node id of the web control, an action type and
some arguments as parameters into a request object. The request
object is pushed to the request queue.
request
Sends the first request, if any, in the request queue to the
server through the Request web service call.
Request
Provides an asynchronous web service call.
Returns the server status.
preReceiveCallback
Forwards the status to the main receive callback function. At
this point another request may be sent. The client feeds the
server with requests as fast as possible, given that the requests
must reach the server in the same order they are sent.
receiveCallback
If the status is Idle or Executing
it forwards the received change objects to the document update
function.
If the status is either Executing or Loading
the client will query for changes after some time, if querying
is not already scheduled by an earlier callback.
update
Parses each change object and updates the document accordingly.
sleep
Schedules a query for changes in a dynamically determined number
of milliseconds.
Query for changes
Provides an asynchronous web service call.
Returns the server status and possibly a list of change objects.
error
Redirects the browser to an error page.
This function is called not only when the server reports an
error as indicated, but also upon failure in the update function
or in any of the asynchronous server calls.
Needs refresh
Provides an asynchronous web service call.
If the client has been inactive for some time it returns true
whereby a refresh request is pushed to the request queue. This
call also serves as a signal to tell the server not to remove
the document.
Idle or Finished?
When the response status is Idle the Client Communication
Engine updates the client document and goes to an idle state,
unless another request has recently been pushed to the request
queue.
If the request queue is empty and the server has returned
Idle, it is still often the case that the last update
altered one or more image sources. The interaction is not finished
until all images have been downloaded from the server.
It is possible to register JavaScript functions that trigger
on this condition. When the user clicks on the Close
button it may have an additional function sending a close signal
to the server in order to clean up resources.