Home - Webxdc Specification

sendUpdate

window.webxdc.sendUpdate(update, descr);

Send an update to all peers.

All peers, including the sending one, will receive the update by the callback given to setUpdateListener().

There are situations where the user cannot send messages to a chat, e.g. if the webxdc instance comes as a contact request or if the user has left a group. In these cases, an app can still call sendUpdate(), but the update won't be sent to other peers and it will not be passed to setUpdateListener().

The update object has the following properties:

The descr argument is deprecated but for backward compatibility apps should pass an empty string.

Using info and href to provide navigation

If a user clicks on an info message that has a href specified then the webxdc app will be started and navigate to the specified location.

For example, a calendar app can send an update to add a new calendar event. The info would be shown in the chat and if the user taps or clicks on it the app is started (if it is not running already) and navigates to the new href which can for example directly show the day and highlight the added event.

Messaging layer limits for sendUpdate

A messaging layer SHOULD expose the following limits to web applications:

If the messaging layer does not expose these limits then webxdc apps should assume the following defaults:

Examples for using sendUpdate limits

If using the default limits, a webxdc editor app could send combined changes in a single sendUpdate call at most every 10 seconds so that the messaging layer will attempt to send each update immediately. If the editor app were to call sendUpdate every 2 seconds instead, updates might get queued for a longer time than just the sendUpdateInterval.

Moreover, an editor can also inspect sendUpdateMaxSize and send oversized updates in smaller chunks and recombine them on the receiving side.