StreamLink for iOS  7.0.1.306702
StreamLink for iOS Documentation

Overview

StreamLink for iOS (SL4i) is an Objective C API that allows an iOS application to exchange real-time financial data and trade messages with a Caplin Liberator server via the Web or other TCP/IP network.

It provides the following capabilities:

  • Record Subscriptions (including type2 and type 3 data)
  • Container subscriptions
  • Permission subscriptions
  • Connection status notification
  • Reconnection
  • Publish data to record subjects
  • Creating and deleting objects on the Liberator.
  • Throttling of individual subjects.
  • Throttling of the entire session.
  • Snapshot requests for supported subject types.

Getting Started

It is recommended that you read the Caplin StreamLink Overview to gain understanding of:

  • What StreamLink is and how it can be used.
  • Fundamental StreamLink concepts & features.
  • How StreamLink can integrate with your own client application software to provide a streaming data display and support online trading of financial instruments.

Using StreamLink for iOS

Building StreamLink for iOS into your application

StreamLink for iOS is distributed as a framework containing support for both the Device Simulator and the Device. To use SL4i you should add a reference to StreamLink.framework in your XCode target. You will also need to add a reference to the following iOS frameworks:

  • SystemConfiguration.framework.
  • Foundation.framework.
  • CFNetwork.framework.

Subscribing to data and receiving updates

To subscribe to data and receive updates to the data you need to:

  • implement (code) some protocols from the API User Layer,
  • call various methods from the API User Layer to connect to a Liberator and set up the subscription.

Handling responses

The API operates asynchronously. This means that when the client application code issues a subscription request or a command to SL4i, the response is not returned immediately through the method used to issue the request or command. Instead, you must set up a listener object (SLSubscriptionListener) containing one or more callback methods. You then supply this listener to SL4i. SL4i calls the appropriate callback method(s) on the listener object to communicate data and command responses back to the client code.

Implementing protocols

Much of the SL4i API is defined as Objective C protocols. You must implement some of the protocols in order use SL4i. Others can be optionally implemented depending on the requirements of your application. These implementations effectively integrate StreamLink with your client application. There are also protocols with implementations that are built into the API, so in these cases you do not need to write your own.

Note
The description of each protocol states if you must implement it before use.

As a minimum you need to implement the SLSubscriptionListener protocol. SL4i calls the SLSubscriptionListener implementation to deal with events concerning subscriptions to data.

You should also implement the SLConnectionListener protocol if you want to provide users of your application with information about the state of the connection.

Handling connectivity

StreamLink for iOS automatically handles transitions between cellular and wireless networks. This is achieved using the standard iOS SCNetworkReachability API. As a result, StreamLink for iOS will:

  • Prefer connecting over wireless should both wireless and cellular networks be available.
  • Always reconnect over wireless should a wireless network become available.
  • Always reconnect over the cellular network should the wireless network cease to be available and a cellular network connection is available.
  • Not attempt to connect to the Liberator if no network connection is available. In this case, StreamLink for iOS raises an SLConnectionStatusEvent with a status of SL_CONN_UNREACHABLE.
  • Automatically recover the connection should a network connection become available.

Following loss of connection via a wireless network, it may take some time for StreamLink for iOS to reconnect via a cellular network; this delay is characteristic of cellular networks.