Class LiveScoutFeedImpl
- java.lang.Object
-
- com.sportradar.livedata.sdk.feed.livescout.classes.LiveScoutFeedImpl
-
- All Implemented Interfaces:
UserRequestManager
,LiveScoutFeed
public class LiveScoutFeedImpl extends Object implements LiveScoutFeed
ALiveScoutFeed
implementation used to manage live-scout feed.
-
-
Constructor Summary
Constructors Constructor Description LiveScoutFeedImpl(ProtocolManager<OutgoingMessage,LiveScoutEntityBase> protocolManager, LiveScoutUserRequestManager userRequestManager, LiveScoutDispatcher dispatcher, LiveScoutSettings settings)
Initializes a new instance of theLiveScoutFeedImpl
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bookMatches(EventIdentifier[] eventIds)
Book the specified matches.void
close()
Closes the communication channel with the live-scout server.void
dispose()
Closes the current feed, and disposes all resources associated with it.ConnectionParams
getConnectionParams()
Holds data about underlying connection parametersvoid
getMatchList(int hoursBack, int hoursForward, boolean includeAvailable)
Get a list of matchesvoid
getMatchList(int hoursBack, int hoursForward, boolean includeAvailable, Collection<Long> sportIds, Collection<Long> matchIds)
Requests a list of available scout matches for a given time frame.EventIdentifier[]
getSubscribedEvents()
Gets the ids of all subscribed matches.TestManager
getTestManager()
When connected to the test server you can obtain a manager to manipulate it.boolean
isOpened()
Gets the value specifying whether the current feed is openedvoid
open(LiveScoutFeedListener listener)
Opens the communication channel with the live-scout servervoid
requestServerTime()
Makes a server time request.void
subscribe(EventIdentifier[] eventIds)
Subscribe to specified matches.void
subscribeToTest(EventIdentifier eventId, Integer messageDelay, Integer startMessage)
Request a full feed for the match, and then update messages will follow in the same pace as they were sent out live.void
unsubscribe(EventIdentifier[] eventIds)
Un-subscribe from the specified matches.
-
-
-
Constructor Detail
-
LiveScoutFeedImpl
public LiveScoutFeedImpl(ProtocolManager<OutgoingMessage,LiveScoutEntityBase> protocolManager, LiveScoutUserRequestManager userRequestManager, LiveScoutDispatcher dispatcher, LiveScoutSettings settings)
Initializes a new instance of theLiveScoutFeedImpl
class.- Parameters:
protocolManager
- AProtocolManager
implementation used to manage the underlying protocol and related componentsuserRequestManager
- TheUserRequestManager
used to process user requests.dispatcher
- ALiveScoutDispatcher
implementation used to dispatch messages to the user.settings
- Provided settings.- Throws:
IllegalArgumentException
- TheprotocolManager
is a null reference or auserRequestManager
is a null reference or adispatcher
is a null reference.
-
-
Method Detail
-
isOpened
public boolean isOpened()
Gets the value specifying whether the current feed is opened- Specified by:
isOpened
in interfaceLiveScoutFeed
- Returns:
- the value specifying whether the current feed is opened
-
open
public void open(LiveScoutFeedListener listener)
Opens the communication channel with the live-scout server- Specified by:
open
in interfaceLiveScoutFeed
- Parameters:
listener
- TheLiveScoutFeedListener
instance used to observe the currentLiveScoutFeed
-
getConnectionParams
public ConnectionParams getConnectionParams()
Description copied from interface:LiveScoutFeed
Holds data about underlying connection parameters- Specified by:
getConnectionParams
in interfaceLiveScoutFeed
- Returns:
- feed connection parameters
-
getMatchList
public void getMatchList(int hoursBack, int hoursForward, boolean includeAvailable, Collection<Long> sportIds, Collection<Long> matchIds)
Requests a list of available scout matches for a given time frame.
By default only matches you have access to will be sent. You can also request all available matches by setting theincludeAvailable
If this is done the reply will also include matches that are open for booking.- Specified by:
getMatchList
in interfaceLiveScoutFeed
- Parameters:
hoursBack
- Specifies the open of the time framehoursForward
- Specifies the end of the time frameincludeAvailable
- Specifies whether matches available for booking should be includedsportIds
- - filter by sports ids, nullablematchIds
- - filter by matches ids, nullable
-
getMatchList
public void getMatchList(int hoursBack, int hoursForward, boolean includeAvailable)
Description copied from interface:LiveScoutFeed
Get a list of matches- Specified by:
getMatchList
in interfaceLiveScoutFeed
- Parameters:
hoursBack
- - number of hours back (from current time)hoursForward
- - number of hours forward (from current time)includeAvailable
- - include also available matches (which you have not booked yet)
-
requestServerTime
public void requestServerTime()
Description copied from interface:LiveScoutFeed
Makes a server time request. This method can block to prevent going over the server limits. Use this call in non SDK dispatcher thread!- Specified by:
requestServerTime
in interfaceLiveScoutFeed
-
bookMatches
public void bookMatches(EventIdentifier[] eventIds)
Book the specified matches. Booked matches cannot be cancelled through this interface.You should prefer using the Live Calendar on the Betradar website (http://www.betradar.com) which offers automatic booking for certain types of matches.
Note that booking matches will have a cost depending on the type of agreement you have with Sportradar.
LiveScout: Expect
LiveScoutFeedListener.onMatchBooked(LiveScoutFeed, MatchBookingEntity)
message in reply.- Specified by:
bookMatches
in interfaceUserRequestManager
- Parameters:
eventIds
- The id of events to book
-
getSubscribedEvents
public EventIdentifier[] getSubscribedEvents()
Gets the ids of all subscribed matches.- Specified by:
getSubscribedEvents
in interfaceUserRequestManager
- Returns:
- the ids of all subscribed matches.
-
subscribe
public void subscribe(EventIdentifier[] eventIds)
Subscribe to specified matches. LiveScout: ExpectLiveScoutFeedListener.onMatchUpdateReceived(LiveScoutFeed, MatchUpdateEntity)
message is response. If match subscription is successful, a full match update is sent out. Otherwise explanation will be given in the response message (e.g. you do not have access to the match or there are already two open subscriptions for the match). With LiveScout you must explicitly callUserRequestManager.subscribe(EventIdentifier[])
at open-up or no data will be received.- Specified by:
subscribe
in interfaceUserRequestManager
- Parameters:
eventIds
- Array of event ids
-
unsubscribe
public void unsubscribe(EventIdentifier[] eventIds)
Un-subscribe from the specified matches. After this no more events associated with these matches will be sent. LiveScout: ExpectLiveScoutFeedListener.onMatchStopped(LiveScoutFeed, MatchStopEntity)
message in response.- Specified by:
unsubscribe
in interfaceUserRequestManager
- Parameters:
eventIds
- Array of event ids from which to un-subscribe
-
subscribeToTest
public void subscribeToTest(EventIdentifier eventId, Integer messageDelay, Integer startMessage)
Request a full feed for the match, and then update messages will follow in the same pace as they were sent out live.
This should only be used on the test server.
- Specified by:
subscribeToTest
in interfaceLiveScoutFeed
- Parameters:
eventId
- The id of the event.messageDelay
- Specifies how many milliseconds to wait between sending out each messagestartMessage
- Specifies which message to open replay on (how far into the match). IfstartMessage
is greater than or equal to the number of messages for the match, a full feed for the finished match is sent out, and no more messages will follow after this.
-
getTestManager
public TestManager getTestManager()
When connected to the test server you can obtain a manager to manipulate it.- Specified by:
getTestManager
in interfaceUserRequestManager
- Returns:
- a
TestManager
implementation
-
close
public void close()
Closes the communication channel with the live-scout server.- Specified by:
close
in interfaceLiveScoutFeed
-
dispose
public final void dispose()
Closes the current feed, and disposes all resources associated with it. Once the feed is disposed, it can n longer be used.- Specified by:
dispose
in interfaceLiveScoutFeed
-
-