Table of Contents

Class GatewayConfiguration

Namespace
DisCatSharp
Assembly
DisCatSharp.dll

Configuration for Discord gateway connection settings.

public sealed class GatewayConfiguration
Inheritance
GatewayConfiguration
Inherited Members

Constructors

GatewayConfiguration()

Creates a new gateway configuration with default values.

GatewayConfiguration(GatewayConfiguration)

Creates a clone of another gateway configuration.

Properties

Advanced

Advanced transport tuning options.

Most applications should not need to modify these settings.

AutoReconnect

Sets whether to automatically reconnect in case a connection is lost.

Defaults to true.

Capabilities

Gets or sets the gateway capabilities for this connection.

CompressionLevel

Sets the level of compression for WebSocket traffic.

Disabling this option will increase the amount of traffic sent via WebSocket. Setting Payload will enable compression for READY and GUILD_CREATE payloads. Setting Stream will enable compression for the entire WebSocket stream, drastically reducing amount of traffic.

Defaults to Stream.

LargeThreshold

Sets the member count threshold at which guilds are considered large.

Discord only accepts values between 50 and 250 (inclusive). Values outside this range are silently clamped to the nearest boundary.

Defaults to 250.

MobileStatus

Sets if the bot's status should show the mobile icon.

Defaults to false.

ReconnectIndefinitely

Defines that the client should attempt to reconnect indefinitely.

This is typically a very bad idea to set to true, as it will swallow all connection errors.

Defaults to false.

ShardCount

Sets the total number of shards the bot is on. If not sharding, this value should be left with a default value of 1.

If sharding automatically, this value will indicate how many shards to boot. If left default for automatic sharding, the client will determine the shard count automatically.

Must be greater than 0. The cross-constraint that ShardId must be less than this value is enforced at connection time.

ShardId

Sets the ID of the shard to connect to.

If not sharding, or sharding automatically, this value should be left with the default value of 0.

Must be non-negative and less than ShardCount. The cross-constraint against ShardCount is enforced at connection time — this setter only guards against negative values since the two properties may be assigned in any order during configuration.

UdpClientFactory

Sets the factory method used to create instances of UDP clients.

Use DisCatSharp.Net.Udp.DcsUdpClient.CreateNew() and equivalents on other implementations to switch out client implementations.

Defaults to DisCatSharp.Net.Udp.DcsUdpClient.CreateNew().

WebSocketClientFactory

Sets the factory method used to create instances of WebSocket clients.

Use CreateNew(IWebProxy, IServiceProvider) and equivalents on other implementations to switch out client implementations.

Defaults to CreateNew(IWebProxy, IServiceProvider).