Table of Contents

Interface IProtocolProvider

Namespace
Sportradar.LiveData.Sdk.ProtocolProviders
Assembly
Sportradar.LiveData.Sdk.dll
public interface IProtocolProvider

Properties

AuthService

AuthService AuthService { get; set; }

Property Value

AuthService

ConnectionProvider

The underlying connection provider.

IConnectionProvider ConnectionProvider { get; }

Property Value

IConnectionProvider

IsStarted

Is the protocol provider running? True when yes, false otherwise.

bool IsStarted { get; }

Property Value

bool

LogoutMessage

What should be tried to send before we disconnect?

[Obsolete]
string LogoutMessage { get; }

Property Value

string

ProtocolData

Settings relevant for the protocol.

IProtocolData ProtocolData { get; }

Property Value

IProtocolData

SdkLogger

ISdkLogger SdkLogger { get; }

Property Value

ISdkLogger

Type

Protocol provider type.

ProtocolProviderType Type { get; }

Property Value

ProtocolProviderType

Methods

SendMessageRaw(string, TimeSpan)

Deliver a protocol unit in string format to the server.

void SendMessageRaw(string msg, TimeSpan ttl)

Parameters

msg string

Protocol unit message in string format

ttl TimeSpan

Time how long the message is valid.

  • if TimeSpan.Zero try delivery just once
  • if TimeSpan.FromMilliseconds(-1), meaning Infinity try an infinite number of times
  • else try ttl time long

Exceptions

DisconnectedStateException

If timeout passes without success

RateLimitingException

If sending the message would be over the limit

SendMessage<T>(T)

Deliver a protocol unit to the server (no matter whether it is connected or sure).

void SendMessage<T>(T msg) where T : IProtocolRequest

Parameters

msg T

Protocol unit message

Type Parameters

T

Protocol unit type derived from IProtocolRequest

Remarks

This method might block indefinitely.

SendMessage<T>(T, TimeSpan)

Deliver a protocol unit to the server.

void SendMessage<T>(T msg, TimeSpan ttl) where T : IProtocolRequest

Parameters

msg T

Protocol unit message

ttl TimeSpan

Time how long the message is valid.

  • if TimeSpan.Zero try delivery just once
  • if TimeSpan.FromMilliseconds(-1), meaning Infinity try an infinite number of times
  • else try ttl time long

Type Parameters

T

Protocol unit type derived from IProtocolRequest

Exceptions

DisconnectedStateException

If timeout passes without success

RateLimitingException

If sending the message would be over the limit

WaitForConnection()

Block until the connection is established.

bool WaitForConnection()

Returns

bool

true if the connection is established; false if the wait time elapsed and no connection was established

Remarks

The method might return true and the connection can get broken right after that, so do not assume after that method we are for sure in a "connected" state, it might have been just a temporary state.

WaitForConnection(TimeSpan)

Block for a certain amount of time until the connection is established.

bool WaitForConnection(TimeSpan ttl)

Parameters

ttl TimeSpan

Time to wait

Returns

bool

true if the connection is established; false if the wait time elapsed and no connection was established

Remarks

The method might return true and the connection can get broken right after that, so do not assume after that method we are for sure in a "connected" state, it might have been just a temporary state.

WaitForDisconnection()

Block and wait until the connection is not established anymore.

bool WaitForDisconnection()

Returns

bool

WaitForDisconnection(TimeSpan)

Block and wait until the connection is not established anymore.

bool WaitForDisconnection(TimeSpan wait_time)

Parameters

wait_time TimeSpan

Time to wait before timeout

Returns

bool

Events

OnConnected

Invoked when the logical connection to the server is established.

event ConnectionProviderDelegates.ConnectionDelegate OnConnected

Event Type

ConnectionProviderDelegates.ConnectionDelegate

OnDisconnected

Invoked when the logical connection to the server is broken.

event ConnectionProviderDelegates.ConnectionDelegate OnDisconnected

Event Type

ConnectionProviderDelegates.ConnectionDelegate

OnInvalidMessageReceived

Invoked when a message was received by the lower layer that could not be validated or processed.

event ConnectionProviderDelegates.SimpleDataReceivedDelegate OnInvalidMessageReceived

Event Type

ConnectionProviderDelegates.SimpleDataReceivedDelegate

OnLoginFailed

event ConnectionProviderDelegates.LoginFailedDelegate OnLoginFailed

Event Type

ConnectionProviderDelegates.LoginFailedDelegate

OnParsedMessageReceived

Invoked when a new protocol data unit (implementing IProtocolResponse) is received.

event ProtocolProviderDelegates.ParsedDataReceivedDelegate OnParsedMessageReceived

Event Type

ProtocolProviderDelegates.ParsedDataReceivedDelegate