Skip to main content
Logo
Explore APIsContact Us
  • Home
  1. Resources
  2. Virtual Stadium
  3. Chat Settings

Chat Settings

This guide covers chat configuration and odds formatting in the Virtual Stadium Data SDK.


#Settings Provider

The SettingsProvider delivers default settings from the moderation backend. These settings control chat behavior and available features.

#Available Settings

messageLength

Maximum number of characters allowed in a single message.

supportedReactions

Available reaction types for messages:

  • Unicode - Emoji reactions shown as text
  • Custom - Image reactions loaded from URL

allowedCharRanges

Character ranges permitted in messages for content filtering and sanitization.

flashBetTimers

Configuration for flash betting functionality with timing settings.

clientSettings

Client-specific configuration options.

betStopTimeoutSeconds

Timeout duration for bet-related operations.

ChatSettings Data Structure:

kotlin
data class ChatSettings(
    val messageLength: Long,
    val supportedReactions: List<ReactionType>,
    val allowedCharRanges: List<AllowedChatRange>,
    val flashBetTimers: FlashBetTimers?,
    val clientSettings: ClientSettings?,
    val betStopTimeoutSeconds: Int,
)

#Settings Implementation

Access chat settings through the SettingsProvider by injecting it via dependency injection.

The settings flow exposes the current configuration and updates automatically when settings change.

Use settings in your UI to enforce message length limits, display available reactions, and configure betting features.

kotlin
import ag.sportradar.virtualstadium.datasdk.services.SettingsProvider
import androidx.lifecycle.ViewModel
import org.koin.core.component.KoinComponent
import org.koin.core.component.get

class SettingsViewModel :
    ViewModel(),
    KoinComponent {

    val settingsProvider: SettingsProvider
        get() = get()

    val settingsState = settingsProvider.settings
}

Compose UI:

kotlin
@Composable
fun Chat(settingsViewModel: SettingsViewModel = viewModel()) {
    val settingsState by settingsViewModel.settingsState
        .collectAsStateWithLifecycle()
    
    // Use settings in UI
}
swift
import VirtualStadiumDataSDK

class ExampleSettingsViewModel: ObservableObject {

    private var settingsProvider = KoinHelper().getSettingsProvider()

    @Published var chatSettings: ChatSettings?

    init() {
        subscribeToSettingsProvider()
    }

    private func subscribeToSettingsProvider() {
        settingsProvider.settings.subscribe { [weak self] chatSettings in
            self?.chatSettings = chatSettings
        }
    }
}

#Odds Format Provider

The OddsFormatProvider handles different odds formatting types for betslips.

#Supported Odds Formats

OddsType.US

American odds format (e.g., +150, -200). Fully supported locally.

OddsType.EU

European/Decimal odds format (e.g., 2.50, 1.50). Fully supported locally.

OddsType.UK

UK/Fractional odds format (e.g., 3/2, 1/2). Requires backend request for formatting.

warning

For OddsType.UK, request data as soon as possible or before requesting messages to ensure correct formatting. The SDK handles everything else automatically.


#Odds Format Implementation

Access the OddsFormatProvider via dependency injection alongside the SettingsProvider.

Call getUKOddsFormats() when switching to UK odds format to fetch the necessary conversion data from the backend.

US and EU formats work immediately without additional requests.

kotlin
import ag.sportradar.virtualstadium.datasdk.services.OddsFormatProvider
import androidx.lifecycle.ViewModel
import org.koin.core.component.KoinComponent
import org.koin.core.component.get

class SettingsViewModel :
    ViewModel(),
    KoinComponent {

    val oddsFormatProvider: OddsFormatProvider
        get() = get()

    private fun changeOddsType(oddsType: OddsType) {
       if (oddsType == OddsType.UK) {
           oddsFormatProvider.getUKOddsFormats()
       }
    }
}
Last updated about 1 month ago
Is this site helpful?
Virtual Stadium, Moderation, Engagement Tools
Chat ChannelProfile Provider
On this page
  • Settings Provider
  • Available Settings
  • Settings Implementation
  • Odds Format Provider
  • Supported Odds Formats
  • Odds Format Implementation