Class KookSocketConfig
Represents a configuration class for KookSocketClient.
public class KookSocketConfig : KookRestConfig
- Inheritance
-
KookSocketConfig
- Derived
- Inherited Members
Examples
The following config enables the message cache and configures the client to always download user upon guild availability.
var config = new KookSocketConfig
{
AlwaysDownloadUsers = true,
MessageCacheSize = 100
};
var client = new KookSocketClient(config);
Remarks
This configuration, based on KookRestConfig, helps determine several key configurations the socket client depend on. For instance, message cache and connection timeout.
Constructors
KookSocketConfig()
Initializes a new instance of the KookSocketConfig class.
public KookSocketConfig()
Fields
GatewayEncoding
Returns the encoding gateway should use.
public const string GatewayEncoding = "json"
Field Value
RtcpIntervalMilliseconds
Gets the RTCP interval of RTP connection in milliseconds.
public const int RtcpIntervalMilliseconds = 5000
Field Value
Properties
AlwaysDownloadBoostSubscriptions
Gets or sets whether or not all boost subscriptions should be downloaded as guilds come available.
public bool AlwaysDownloadBoostSubscriptions { get; set; }
Property Value
Remarks
note
Setting this property to true
will cause the client to download all boost subscriptions
for all guilds upon startup and when GuildUpdated is triggered with
changes occurring to BoostSubscriptionCount.
Please note that it can be difficult to fill the cache completely on large guilds depending on the
traffic. If you are experiencing issues, try setting this to false
and manually call
DownloadBoostSubscriptionsAsync(IEnumerable<IGuild>?, RequestOptions?) on the guilds you want.
AlwaysDownloadUsers
Gets or sets whether or not all users should be downloaded as guilds come available.
public bool AlwaysDownloadUsers { get; set; }
Property Value
Remarks
note
Setting this property to true
will cause the client to download all users
for all guilds upon startup.
Please note that it can be difficult to fill the cache completely on large guilds depending on the
traffic. If you are experiencing issues, try setting this to false
and manually call
DownloadUsersAsync(IEnumerable<IGuild>?, RequestOptions?) on the guilds you want.
AlwaysDownloadVoiceStates
Gets or sets whether or not all voice states should be downloaded as guilds come available.
public bool AlwaysDownloadVoiceStates { get; set; }
Property Value
Remarks
note
Setting this property to true
will cause the client to download all voice states
for all guilds upon startup.
Please note that it can be difficult to fill the cache completely on large guilds depending on the
traffic. If you are experiencing issues, try setting this to false
and manually call
DownloadVoiceStatesAsync(IEnumerable<IGuild>?, RequestOptions?) on the guilds you want.
AudioClientIdleTimeout
Gets or sets the timeout for the audio client to be considered idle, in milliseconds.
public int AudioClientIdleTimeout { get; set; }
Property Value
AutoUpdateChannelPositions
Gets or sets whether to update guild channels via API when gateway publishes sort_channel events.
public bool AutoUpdateChannelPositions { get; set; }
Property Value
AutoUpdateRolePositions
Gets or sets whether to update guild role positions via API when GuildUpdated fires.
public bool AutoUpdateRolePositions { get; set; }
Property Value
ConnectionTimeout
Gets or sets the time, in milliseconds, to wait for a connection to complete before aborting.
public int ConnectionTimeout { get; set; }
Property Value
GatewayHost
Gets or sets the WebSocket host to connect to. If null
, the client will use the
/gateway endpoint.
public string? GatewayHost { get; set; }
Property Value
HandlerTimeout
Gets or sets the timeout for event handlers, in milliseconds, after which a warning will be logged.
Setting this property to null
disables this check.
public int? HandlerTimeout { get; set; }
Property Value
- int?
HeartbeatIntervalMilliseconds
Gets the heartbeat interval of WebSocket connection in milliseconds.
public int HeartbeatIntervalMilliseconds { get; }
Property Value
JoinedGuildDataFetchingRetryDelay
Gets or sets the delay in milliseconds between each retry of fetching joined guild data.
public int JoinedGuildDataFetchingRetryDelay { get; set; }
Property Value
Exceptions
- ArgumentException
Value must be at least 0.
LargeNumberOfGuildsThreshold
Get or set the threshold quantity considered as joining a large number of guilds.
public uint LargeNumberOfGuildsThreshold { get; set; }
Property Value
MaxJoinedGuildDataFetchingRetryTimes
Gets or sets the maximum number of times to retry fetching joined guild data.
public int MaxJoinedGuildDataFetchingRetryTimes { get; set; }
Property Value
Remarks
Due to the KOOK API cannot return the newly joined guilds immediately well, this property is used to control the maximum number of times to retry fetching joined guild data. Each retry will be delayed by JoinedGuildDataFetchingRetryDelay milliseconds. Set to 0 or negative value to disable retrying.
MessageCacheSize
Gets or sets the number of messages per channel that should be kept in cache. Setting this to zero disables the message cache entirely.
public int MessageCacheSize { get; set; }
Property Value
MessageQueueProvider
Gets or sets the provider used to generate new message queues.
public MessageQueueProvider MessageQueueProvider { get; set; }
Property Value
SmallNumberOfGuildsThreshold
Gets or sets the threshold quantity considered as joining a small number of guilds.
public uint SmallNumberOfGuildsThreshold { get; set; }
Property Value
StartupCacheFetchMode
Gets or sets the startup mode of the socket client.
public StartupCacheFetchMode StartupCacheFetchMode { get; set; }
Property Value
UdpSocketProvider
Gets or sets the provider used to generate new UDP sockets.
public UdpSocketProvider UdpSocketProvider { get; set; }
Property Value
WebSocketProvider
Gets or sets the provider used to generate new WebSocket connections.
public WebSocketProvider WebSocketProvider { get; set; }