StreamLink.NET  7.1.5-7.1.5-3946-4e293d0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Static Public Member Functions | List of all members
Caplin.StreamLink.StreamLinkFactory Class Reference

Factory that creates StreamLink instances. More...

Static Public Member Functions

static IStreamLink Create (string configuration)
 Creates a new IStreamLink instance from the supplied JSON configuration. More...
 
static IStreamLink Create (string configuration, IKeymasterPollResponseListener listener)
 Creates a new IStreamLink instance from the supplied JSON configuration. More...
 
static IStreamLink Create (string configuration, string username, string password)
 Creates a new IStreamLink instance from the supplied configuration and username/password credentials. More...
 
static IStreamLink Create (string configuration, ICredentialsProvider credentialsProvider)
 Creates a new IStreamLink instance from the supplied configuration and CredentialsProvider. More...
 
static IStreamLink Create (IStreamLinkConfiguration configuration)
 Creates a new IStreamLink instance with the supplied IStreamLinkConfigurationInternal object. More...
 
static IStreamLink Create (IStreamLinkConfiguration configuration, ICredentialsProvider credentialsProvider)
 Creates a new IStreamLink instance with the supplied IStreamLinkConfigurationInternal object and ICredentialsProvider. More...
 
static IStreamLinkConfiguration CreateConfiguration ()
 Creates a new StreamLinkConfiguration object that can be used to configure StreamLink. More...
 
static IStreamLinkConfiguration CreateConfiguration (string configuration)
 Creates a new IStreamLinkConfigurationInternal object that can be used to configure StreamLink. It will be populated with the values obtained from the supplied configuration string. More...
 

Detailed Description

Factory that creates StreamLink instances.

You create and configure the StreamLink instance by calling one of the create methods on this factory. The configuration settings are supplied in one of two ways, depending on which particular create method is called:

The configuration format is JSON, which can contain the following attributes:

Attribute name Type Default Optional Description
liberator_urls string, [string], [[string]] None No The Liberator URL groups to connect to (see below).
keymaster_url string None (KeyMaster not used) Yes URL of KeyMaster for secure authentication of Liberator login requests.
keymaster_poll_url string None (KeyMaster not used) Yes URL that StreamLink uses to check the connection to KeyMaster every keymaster_poll_interval milliseconds.
keymaster_poll_interval number 600000 milliseconds
(10 minutes)
Yes Interval in milliseconds at which StreamLink will poll KeyMaster (on keymaster_poll_url) to keep the KeyMaster session open.
keymaster_httpuser string None Yes Username to access the KeyMaster URL.
keymaster_httppass string None Yes Corresponding password to access the KeyMaster URL.
keymaster_rttpuser string None Yes Username that KeyMaster will generate a one-use token for. Use of this configuration option is strongly discouraged. Your KeyMaster instance should determine this value from the keymaster_httpuser option.
username string None Yes Liberator login user-name to use if logins are not being managed by KeyMaster.
password string None Yes Liberator login password to use if logins are not being managed by KeyMaster.
application_id string None Yes Application identifier. This is useful for tracing purposes and managing licensing requirements.
poll_interval number 1000 milliseconds
(1 second)
Yes Time interval in milliseconds between polls of the Liberator. This only applies to HTTP polling type connections (see 'RTTP connection types' in the document StreamLink Overview).
disable_polling boolean false Yes Set to true if you don't want to use polling connection when the rttp(s) protocol is specified.
request_timeout number 10000 milliseconds
(10 seconds)
Yes Time in milliseconds allowed for the response to each request before StreamLink reconnects to the Liberator.
http_timeout number 3000 milliseconds
(3 seconds)
Yes Time in milliseconds allowed for an HTTP Request to finish successfully before StreamLink times out.
http_pad_length number 4096 bytes Yes The amount of padding to use when establishing a streaming connection using the http(s):// connection type. Increasing this value can help should there be a buffering network component between the client and the Liberator.
maximum_connection_limit number 10 Yes The maximum number of connections allowed.
clock_offset_interval number 10000 milliseconds
(10 seconds)
Yes StreamLink calculates a new clock offset value every clock_offset_interval millseconds. The clock offset is Liberator time minus StreamLink time; it is a measure of how much the Liberator and client clocks differ and is used in the calculation of latency statistics, such as average latency (see the latency_interval attribute). Also see getClockOffset.
clock_offset_window number 120000 milliseconds
(2 minutes)
Yes Time in milliseconds a calculated clock offset is valid for use in producing statistics. For the definition of clock offset, see the clock_offset_interval attribute. You should not normally need to change this attribute; if you think it needs to be changed, please contact Caplin Support for advice.
latency_interval number 10000 milliseconds
(10 seconds)
Yes Time in milliseconds between successive calculations of average latency. Latency is the time taken for a StreamLink heartbeat message to be sent from the Liberator to the client. The shorter the latency_interval, the more accurate are the average latency statistics. However, too small a value can adversely impact performance.
latency_window number 120000 milliseconds
(2 minutes)
Yes Time in milliseconds for which a calculated latency value is valid for use in producing latency statistics. The shorter the time, the faster changes in average latency will show up in the statistics. However, too small a value can result in the average varying in a way that makes it hard to see trends.
inactivity_timeout number -1 (disabled) No Set the duration (in milliseconds) that Liberator will use to disconnect this client should no messages have been received from StreamLink
log_buffer_size number -1 (disabled) Yes Sets the number of log lines to be cached in the log buffer.
proxy_address string none Yes The address of a proxy that will be used for http(s):// and poll(s):// streaming connections and KeyMaster connections.
proxy_username string none Yes The username for the proxy that will be used for http(s):// and poll(s):// streaming connections and KeyMaster connections.
proxy_domain string none Yes The domain for the proxy that will be used for http(s):// and poll(s):// streaming connections and KeyMaster connections. This is only required when connecting through an NTLM proxy.
proxy_password string none Yes The password for the proxy that will be used for http(s):// and poll(s):// streaming connections and KeyMaster connections.
reconnect_delay number 1000 Yes Delay in milliseconds before retrying, after failing to connect.
reconnect_cycle_delay array of numbers 2000, 4000, 8000, 16000 Yes Array of backoff delays in milliseconds before retrying, after failing to connect with all available connection options. The entries are treated as a backoff where each entry is used once and the last entry is the delay that will keep getting used forever

Failover configuration using liberator_urls.

The liberator_urls configuration attribute defines the Liberator URL groups to connect to in failover situations. A URL group is selected at random and StreamLink tries to connect to the URLs in the group sequentially. If StreamLink fails to connect to any of the URLs in a group, the next group is tried, and so on.

For more information about how to configure a failover strategy for StreamLink, see the "Resilience, failover, and load balancing" section of the StreamLink Overview.

Each URL specified must include the protocol; one of: rttp, rttps, http, https, poll, polls, tcp, tcps.

Examples:

The following example shows the JSON configuration to connect to a single Liberator instance running on the host liberator1 on port 8080. The credentials to login to the Liberator are specified using the username and password attributes.

{
    "liberator_urls": "rttp://liberator1:8080",
    "username": "test@example.com",
    "password": "my password"
}

The following example shows the JSON configuration for failover between two Liberator pairs. The credentials to login to the Liberator are specified using the username and password attributes.

{
    "liberator_urls": [
      ["rttp://liberator1:8080", "rttp://liberator2:8080"],
      ["rttp://liberator3:8080", "rttp://liberator4:8080"]
    ],
   "username": "test@example.com",
   "password": "my password"
}

Member Function Documentation

static IStreamLink Caplin.StreamLink.StreamLinkFactory.Create ( string  configuration)
inlinestatic

Creates a new IStreamLink instance from the supplied JSON configuration.

Parameters
configurationA JSON configuration string.
Exceptions
ArgumentExceptionThe configuration is invalid.
Returns
A new IStreamLink instance.
static IStreamLink Caplin.StreamLink.StreamLinkFactory.Create ( string  configuration,
IKeymasterPollResponseListener  listener 
)
inlinestatic

Creates a new IStreamLink instance from the supplied JSON configuration.

Parameters
configurationA JSON configuration string.
listenerThe listener that receives the result of KeyMaster poll requests.
Exceptions
ArgumentExceptionThe configuration is invalid.
Returns
A new IStreamLink instance.
static IStreamLink Caplin.StreamLink.StreamLinkFactory.Create ( string  configuration,
string  username,
string  password 
)
inlinestatic

Creates a new IStreamLink instance from the supplied configuration and username/password credentials.

The configuration argument to this method can take the following forms:

  • A URI of the form protocol://liberator:port where protocol can be one of: tcp, tcps, ws, wss, http, https, rttp, rttps
  • A JSON array of failover Liberator addresses: [ [ "protocol://host1", "protocol://host2" ], ["protocol://host3", "protocol://host4" ] ]
  • A JSON configuration object, for example: { "liberator_urls" : [ [ "protocol://host1", "protocol://host2" ], ["protocol://host3", "protocol://host4" ] ] }. If you supply a configuration object, it can contain any of the configuration attributes defined in the table above, in addition to the failover configuration.
Parameters
configurationA Liberator connection URI, or Liberator connection and failover information in JSON format, or a JSON configuration object.
usernameThe username to log in as.
passwordThe password associated with the username.
Exceptions
ArgumentExceptionThe configuration is invalid.
Returns
A new IStreamLink instance.
static IStreamLink Caplin.StreamLink.StreamLinkFactory.Create ( string  configuration,
ICredentialsProvider  credentialsProvider 
)
inlinestatic

Creates a new IStreamLink instance from the supplied configuration and CredentialsProvider.

The configuration argument to this method can take the following forms:

  • A URI of the form protocol://liberator:port where protocol can be one of: tcp, tcps, ws, wss, http, https, rttp, rttps
  • A JSON array of failover Liberator addresses: [ [ "protocol://host1", "protocol://host2" ], ["protocol://host3", "protocol://host4" ] ]
  • A JSON configuration object, for example: { "liberator_urls" : [ [ "protocol://host1", "protocol://host2" ], ["protocol://host3", "protocol://host4" ] ] }. If you supply a configuration object, it can contain any of the configuration attributes defined in the table above, in addition to the failover configuration.
Parameters
configurationA Liberator connection URI, or Liberator connection and failover information in JSON format, or a JSON configuration object.
credentialsProviderYour custom implementation of the ICredentialsProvider interface.
Exceptions
ArgumentExceptionThe configuration is invalid.
Returns
A new IStreamLink instance.

returns>

static IStreamLink Caplin.StreamLink.StreamLinkFactory.Create ( IStreamLinkConfiguration  configuration)
inlinestatic

Creates a new IStreamLink instance with the supplied IStreamLinkConfigurationInternal object.

This method permits the construction of a StreamLink instance

Parameters
configurationConfiguration for this StreamLink instance.
Returns
A new IStreamLink instance.
static IStreamLink Caplin.StreamLink.StreamLinkFactory.Create ( IStreamLinkConfiguration  configuration,
ICredentialsProvider  credentialsProvider 
)
inlinestatic

Creates a new IStreamLink instance with the supplied IStreamLinkConfigurationInternal object and ICredentialsProvider.

This method permits the construction of a StreamLink instance

Parameters
configurationConfiguration for this StreamLink instance.
credentialsProviderYour implementation of the ICredentialsProvider interface.
Returns
A new IStreamLink instance.

returns>

static IStreamLinkConfiguration Caplin.StreamLink.StreamLinkFactory.CreateConfiguration ( )
inlinestatic

Creates a new StreamLinkConfiguration object that can be used to configure StreamLink.

Returns
A new IStreamLinkConfiguration instance.
static IStreamLinkConfiguration Caplin.StreamLink.StreamLinkFactory.CreateConfiguration ( string  configuration)
inlinestatic

Creates a new IStreamLinkConfigurationInternal object that can be used to configure StreamLink. It will be populated with the values obtained from the supplied configuration string.

The configuration argument to this method can take the following forms:

  • A URI of the form protocol://liberator:port where protocol can be one of: tcp, tcps, http, https, rttp, rttps
  • A JSON array of failover Liberator addresses: [ [ "protocol://host1", "protocol://host2" ], ["protocol://host3", "protocol://host4" ] ]
  • A JSON configuration object, for example: { "liberator_urls" : [ [ "protocol://host1", "protocol://host2" ], ["protocol://host3", "protocol://host4" ] ] }. If you supply a configuration object, it can contain any of the configuration attributes defined in the table above, in addition to the failover configuration.
Parameters
configurationA Liberator connection URI, or Liberator connection and failover information in JSON format, or a JSON configuration object.
Returns
A new IStreamLinkConfigurationInternal instance with values populated from the supplied configuration string.

Generated on Tue Mar 24 2020 11:57:50 for StreamLink.NET