View Source

h2. Push API

The Push API is available and valid only when ICEpush is enabled for the application.


The following Form APIs are available:

* *{{[ice.onBlockingConnectionLost(callback)|#onBlockingConnectionLost]}}*
* *{{[ice.onBlockingConnectionServerError(callback)|#onBlockingConnectionServerError]}}*
* *{{[ice.onBlockingConnectionUnstable(callback)|#onBlockingConnectionUnstable]}}*
* *{{[ice.onBlockingConnectionReEstablished(callback)|#onBlockingConnectionReEstablished]}}*
* *{{[ice.onBlockingConnectionReceive(callback)|#onBlockingConnectionReceive]}}*

----

\\
{anchor:onBlockingConnectionLost}
{panel}
h4. ice.onBlockingConnectionLost(callback)

Accepts a reference to a callback function. The callback function will be invoked when the blocking connection to the server has been lost and is considered unrecoverable.

_Usage:_

{code:javascript}var connectionLostHandler = function(reconnectionAttempts) {
...
};
ice.onBlockingConnectionLost(connectionLostHandler);
{code}
{_}Parameters:_

* reconnectionAttempts
bq. The number of reconnect attempts made by the bridge to re-establish the connection before considering the connection unrecoverable.
{panel}
\\
{anchor:onBlockingConnectionServerError}
{panel}
h4. ice.onBlockingConnectionServerError(callback)

Accepts a reference to a callback function. The callback function will be invoked when a server error is received by the browser on the blocking connection.

_Usage:_

{code:javascript}var serverErrorHandler = function(statusCode, responseText, responseDOM) {
...
};
ice.onBlockingConnectionServerError(serverErrorHandler);
{code}
{_}Parameters:_

* statusCode
bq. The HTTP status code.

* responseText
bq. The body of the HTTP response in text format.

* responseDOM
bq. The parsed body of the HTTP response as XML. This parameter is present only when response is in XML/HTML format.
{panel}
\\
{anchor:onBlockingConnectionUnstable}
{panel}
h4. ice.onBlockingConnectionUnstable(callback)

Accepts a reference to a callback function. The callback function will be invoked when the client bridge's hearbeat detects that the server isn't responding in a timely fashion.

_Usage:_

{code:javascript}var connectionUnstableHandler = function() {
...
};
ice.onBlockingConnectionUnstable(connectionUnstableHandler);
{code}
{_}Parameters:_

* none
{panel}

{anchor:onBlockingConnectionReEstablished}
{panel}
h4. ice.onBlockingConnectionReEstablished(callback)

Accepts a reference to a callback function. The callback function will be invoked when the client bridge's re-establishes the blocking connection. This could be caused by a transient network issue or when switching the blocking connection to a new window.

_Usage:_

{code:javascript}var connectionReEstablishedHandler = function() {
...
};
ice.onBlockingConnectionUnstable(connectionReEstablishedHandler);
{code}
{_}Parameters:_

* none
{panel}

{anchor:onBlockingConnectionReceive}
{panel}
h4. ice.onBlockingConnectionReceive(callback)

Accepts a reference to a callback function. The callback function will be invoked when the client bridge's messages from the server are received normally.

_Usage:_

{code:javascript}var connectionReceiveHandler = function() {
...
};
ice.onBlockingConnectionReceive(connectionReceiveHandler);
{code}
{_}Parameters:_

* message
bq. The received message.
{panel}
\\