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
IsInitialized
True if the SDK initialized, false otherwise. See the Initialize().
public bool IsInitialized { get; }
Property Value
IsStarted
True if the SDK started, false otherwise. See the Initialize().
public bool IsStarted { get; }
Property Value
LiveScout
LiveScout provider.
public ILiveScout LiveScout { get; }
Property Value
QueueStats
Queue statistics.
public IList<ClientQueueStats> QueueStats { get; }
Property Value
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_factoryIConfigFactoryA factory for obtaining the configuration AppConfigFactory
dead_letter_queueIDeadLetterQueueOptional 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_namestringName of the section in the configuration file
dead_letter_queueIDeadLetterQueueOptional 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.
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