SL4B provides connection failover functionality, allowing a client application that has lost its connection to a Liberator to failover and connect to another Liberator instead. It also provides client side load balancing, where each client randomly selects which primary Liberator it will initially attempt to connect to.
Containers are a way of grouping objects in the Liberator so that they can be subscribed to as a unit rather than individually.

Containers are created in the datasource providing the data.
To subscribe to a container the client must use the
SL4B_AbstractRttpProvider.getContainer()
method. An example is provided below.
ExampleSubscriber.prototype = new SL4B_AbstractSubscriber;
function ExampleSubscriber()
{
this.initialise();
}
var exampleSubscriber = new ExampleSubscriber();
SL4B_Accessor.getRttpProvider().getContainer(exampleSubscriber, "/CONTAINERNAME", "Field1,Field2");
SL4B_AbstractSubscriber.structureMultiChange() callback on the registered subscriber.
ExampleSubscriber.prototype.structureMultiChange = ExampleSubscriber_StructureMultiChange;
function ExampleSubscriber_StructureMultiChange (containerName, containerStructureChanges, elementOrderChanges, totalContainerSize)
{
// process changes in container structure
}
To be notified of changes for all the constituent objects the client must implement the recordMultiUpdated()
callback on the registered subscriber.
ExampleSubscriber.prototype.recordMultiUpdated = ExampleSubscriber_RecordMultiUpdated;
function ExampleSubscriber_RecordMultiUpdated(objectName, fieldData)
{
// process changes for container constituent fields
}
Event 1: A container has been newly subscribed to, it contains 3 items.

The structureMultiChange() callback would consist of:
Event 2: A new symbol /ITEM_Y has been added to the container at position 1 (between /ITEM_A and /ITEM_B, position is zero based)

The structureMultiChange() callback would consist of:
Event 3: Symbol /ITEM_Y is subsequently deleted.

The structureMultiChange() callback would consist of:
Event 4: Symbol /ITEM_X is added at the end of the container and /ITEMC is deleted.

The structureMultiChange() callback would consist of:
Paging is the ability to request a subset of a container's contents. For example a container may have 1800 objects within it, however the
client may only want to display the first 20.

By setting paging using the optional windowStart and windowEnd arguments on the
SL4B_AbstractRttpProvider.getContainer() method, updates and structural changes
for items outside the window are not received.
ExampleSubscriber.prototype = new SL4B_AbstractSubscriber;
function ExampleSubscriber()
{
this.initialise();
}
var exampleSubscriber = new ExampleSubscriber();
var windowStartPos = 0;
var windowEndPos = 9;
var containerKey = SL4B_Accessor.getRttpProvider().getContainer(exampleSubscriber, "/CONTAINERNAME", "Field1,Field2", windowStartPos, windowEndPos);
To control paging after the initial request, use the SL4B_AbstractRttpProvider.setContainerWindow() method.
SL4B_Accessor.getRttpProvider().setContainerWindow(exampleSubscriber.containerKey, 10, 19);
To clear the window and receive updates for the whole container, use
SL4B_AbstractRttpProvider.clearContainerWindow().
SL4B_Accessor.getRttpProvider().clearContainerWindow(exampleSubscriber.containerKey);
As changes are made to the container window, structure updates (via the structureMultiChange() callback) are notified to the client so that it can keep its view up to date. An illustration is provided below.
Event 1: The first 5 items (0-4) are requested from a container with 10 items inside it.

The structureMultiChange() callback would consist of:


The container example (found in .../examples/sl4b/container-demo.html within the kit) shows an example of how to request and page through a container.