Interface IConnectionProvider
- Namespace
- Sportradar.LiveData.Sdk.Common.Interfaces
- Assembly
- Sportradar.LiveData.Sdk.dll
Connection provider
public interface IConnectionProvider
Properties
ConnectionData
Obtain current connection data
IConnectionData ConnectionData { get; }
Property Value
IsStarted
Obtain whether the connection provider is running.
bool IsStarted { get; }
Property Value
RxEnabled
Whether reading from input stream is enabled or not (i.e. input msg queue going over the high watermark should disable all RX)
ManualResetEventSlim RxEnabled { get; }
Property Value
Methods
Error(string, string)
Start immediate error recovery. Usually due to an error on the upper layer.
[Obsolete]
void Error(string opt_protocol_message, string log_message)
Parameters
opt_protocol_messagestringOptional message that should be sent before disconnection
log_messagestringInformative error description
IsReceiveThread()
bool IsReceiveThread()
Returns
SendMessage(string, bool)
Deliver a protocol unit (as a string) to the server.
bool SendMessage(string message, bool only_try = false)
Parameters
Returns
Exceptions
- DisconnectedStateException
If we are currently disconnected
Start()
Start the connection provider (connects to the
server and start the automatic reconnection).
void Start()
Start(IConnectionData)
Start the connection provider (connects to the server and start the automatic reconnection).
void Start(IConnectionData connection_data)
Parameters
connection_dataIConnectionDataconnection data
Stop(string)
Stop the connection provider. Opposite of Start().
void Stop(string opt_protocol_message)
Parameters
opt_protocol_messagestringOptional message that should be sent before disconnection
WaitForConnection()
Block and wait until the connection is established.
bool WaitForConnection()
Returns
- bool
true if the connection is established; false (should rarely happen) in case of a race-condition or when wait_time times out
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)
bool WaitForConnection(TimeSpan wait_time)
Parameters
wait_timeTimeSpan
Returns
WaitForDisconnection()
Block and wait until the connection is not established anymore.
bool WaitForDisconnection()
Returns
WaitForDisconnection(TimeSpan)
bool WaitForDisconnection(TimeSpan wait_time)
Parameters
wait_timeTimeSpan
Returns
Events
OnAliveCheckNecessary
Invoked when the protocol requires an alive check.
event ConnectionProviderDelegates.AliveCheckNecessaryDelegate OnAliveCheckNecessary
Event Type
OnCommunicationError
Invoked when a communication error on the physical connection is detected
event ConnectionProviderDelegates.CommunicationErrorDelegate OnCommunicationError
Event Type
OnConnected
Invoked when the physical connection to the server is established.
event ConnectionProviderDelegates.ConnectionDelegate OnConnected
Event Type
OnDisconnected
Invoked when the physical connection to the server is dropped.
event ConnectionProviderDelegates.ConnectionDelegate OnDisconnected
Event Type
OnMessageReceived
Invoked when a new protocol data unit in string format is received.
event ConnectionProviderDelegates.DataReceivedDelegate OnMessageReceived
Event Type
OnValidDataCheckNecessary
Invoked when the protocol requires a check for valid data.
event ConnectionProviderDelegates.ValidDataCheckNecessaryDelegate OnValidDataCheckNecessary