Table of Contents

Class Sdk

Namespace
Sportradar.LiveData.Sdk.Services
Assembly
Sportradar.LiveData.Sdk.dll

Main entry point for the SDK client application.

public sealed class Sdk : IStartable, IDisposable
Inheritance
Sdk
Implements
Inherited Members

Examples

try
{
    Sdk.Instance.Initialize();

    Sdk.Instance.OnQueueLimits += QueueLimits;
    Sdk.Instance.OnQueueLimitRetreated += QueueLimitRetreated;

    Sdk.Instance.Start();

    if (Sdk.Instance.LiveOdds != null)
    {
        Sdk.Instance.LiveOdds.OnConnectionStable += FlagConnectionAsStable;
        Sdk.Instance.LiveOdds.OnConnectionUnstable += ConnectionUnstable;

        Sdk.Instance.LiveOdds.OnAlive += AliveReceived;
        Sdk.Instance.LiveOdds.OnFeedError += FeedErrorOccurred;
        Sdk.Instance.LiveOdds.OnBetCancel += MatchBetCancelled;
        Sdk.Instance.LiveOdds.OnBetCancelUndo += MatchBetCancelUndo;
        Sdk.Instance.LiveOdds.OnBetClear += MatchBetCleared;
        Sdk.Instance.LiveOdds.OnBetClearRollback += MatchBetClearRollbacked;
        Sdk.Instance.LiveOdds.OnBetStart += BetStarted;
        Sdk.Instance.LiveOdds.OnBetStop += BetStopped;
        Sdk.Instance.LiveOdds.OnMetaInfo += MetaInfoReceived;
        Sdk.Instance.LiveOdds.OnOddsChange += OddsChanged;
        Sdk.Instance.LiveOdds.OnScoreCardSummary += ScoreCardReceived;

        Sdk.Instance.LiveOdds.Start();
    }
    else
    {
        throw new ApplicationException("Error initializing SDK.LiveOdds provider");
    }

    /* ... start using the SDK ... */
    Console.ReadLine();
}
finally
{
    if (Sdk.Instance.LiveOdds != null)
    {
    	Sdk.Instance.LiveOdds.Stop();

    	Sdk.Instance.LiveOdds.OnConnectionStable -= FlagConnectionAsStable;
    	Sdk.Instance.LiveOdds.OnConnectionUnstable -= ConnectionUnstable;

    	Sdk.Instance.LiveOdds.OnAlive -= AliveReceived;
    	Sdk.Instance.LiveOdds.OnFeedError -= FeedErrorOccurred;
    	Sdk.Instance.LiveOdds.OnBetCancel -= MatchBetCancelled;
    	Sdk.Instance.LiveOdds.OnBetCancelUndo -= MatchBetCancelUndo;
    	Sdk.Instance.LiveOdds.OnBetClear -= MatchBetCleared;
    	Sdk.Instance.LiveOdds.OnBetClearRollback -= MatchBetClearRollbacked;
    	Sdk.Instance.LiveOdds.OnBetStart -= BetStarted;
    	Sdk.Instance.LiveOdds.OnBetStop -= BetStopped;
    	Sdk.Instance.LiveOdds.OnMetaInfo -= MetaInfoReceived;
    	Sdk.Instance.LiveOdds.OnOddsChange -= OddsChanged;
    	Sdk.Instance.LiveOdds.OnScoreCardSummary -= ScoreCardReceived;
    }

    Sdk.Instance.OnQueueLimits -= QueueLimits;
    Sdk.Instance.OnQueueLimitRetreated -= QueueLimitRetreated;

    Sdk.Instance.Stop();
}

Properties

Instance

SDK singleton instance.

public static Sdk Instance { get; }

Property Value

Sdk

IsInitialized

True if the SDK initialized, false otherwise. See the Initialize().

public bool IsInitialized { get; }

Property Value

bool

IsStarted

True if the SDK started, false otherwise. See the Initialize().

public bool IsStarted { get; }

Property Value

bool

LiveScout

LiveScout provider. Initialize() must be called before accessing this member. If provider is not enabled through configuration, this member will be null.

public ILiveScout LiveScout { get; }

Property Value

ILiveScout

QueueStats

Queue statistics.

public IList<ClientQueueStats> QueueStats { get; }

Property Value

IList<ClientQueueStats>

Methods

Dispose()

Releases unmanaged resources held by an instance of this class.

public void Dispose()

~Sdk()

protected ~Sdk()

Initialize()

Initialize the SDK. Default section name is used from the app.config. DEFAULT_SECTION_NAME

public void Initialize()

Initialize(IConfigFactory, IDeadLetterQueue)

Initialize the SDK.

public void Initialize(IConfigFactory config_factory, IDeadLetterQueue dead_letter_queue = null)

Parameters

config_factory IConfigFactory

A factory for obtaining the configuration AppConfigFactory

dead_letter_queue IDeadLetterQueue

Optional interface where a client can be notified about messages that could not be delivered (can be null)

Examples

Initialize(AppConfigFactory.FromSection("Sdk"), DeadLetterInstance)

Remarks

Config factory is used explicitly instead of actual configuration to emphasize that configuration is immutable for the application after it is built (internally). It can (depending on the type of the factory) still be updated in run-time by changing the configuration file.

Initialize(string, IDeadLetterQueue)

Initialize the SDK.

public void Initialize(string section_name, IDeadLetterQueue dead_letter_queue = null)

Parameters

section_name string

Name of the section in the configuration file

dead_letter_queue IDeadLetterQueue

Optional interface where a client can be notified about messages that could not be delivered (can be null)

Start()

Starts the SDK instance but does not start the configured feed providers (e.g. LiveScout or LiveOdds). SDK message dispatcher pump will start delivering messages after this. Feed providers should be started explicitly after SDK singleton is started.

public void Start()

Stop()

Stops the SDK. Stops the message pump and all feeds.

public void Stop()

Events

OnQueueLimits

Indicates that a queue limit (NORMAL, LOW, HIGH) was either reached or retreated for a specific queue.

public event LimitedPriorityQueueDelegates.QueueLimitDelegate OnQueueLimits

Event Type

LimitedPriorityQueueDelegates.QueueLimitDelegate