Table of Contents

Class HeyBoxSocketConfig

Namespace
HeyBox.WebSocket
Assembly
HeyBox.Net.WebSocket.dll

表示一个用于 HeyBoxSocketClient 的配置类。

public class HeyBoxSocketConfig : HeyBoxRestConfig
Inheritance
HeyBoxSocketConfig
Inherited Members

Examples

以下代码启用了消息缓存,并配置客户端在房间可用时始终下载用户。

var config = new HeyBoxSocketConfig
{
    AlwaysDownloadUsers = true,
    MessageCacheSize = 100
};
var client = new HeyBoxSocketClient(config);

Remarks

此配置基于 HeyBoxRestConfig,在与 REST 有关的配置的基础上,定义了有关网关的配置。

Constructors

HeyBoxSocketConfig()

初始化一个 HeyBoxSocketConfig 类的新实例。

public HeyBoxSocketConfig()

Fields

DefaultGatewayUrl

获取或设置要连接的网关端口。

public const string DefaultGatewayUrl = "wss://chat.xiaoheihe.cn/chatroom/ws/connect"

Field Value

string

GatewayEncoding

获取网关使用的数据格式。

public const string GatewayEncoding = "json"

Field Value

string

Properties

ConnectionTimeout

获取或设置连接到网关时的超时时间间隔(毫秒)。

public int ConnectionTimeout { get; set; }

Property Value

int

GatewayHost

获取或设置要连接的网关地址。

public string? GatewayHost { get; set; }

Property Value

string

HandlerTimeout

获取或设置阻塞网关线程的事件处理程序的超时时间间隔(毫秒),超过此时间间隔的阻塞网关线程的事件处理程序会被日志记录警告。将此属性设置为 null 将禁用此检查。

public int? HandlerTimeout { get; set; }

Property Value

int?

HeartbeatIntervalMilliseconds

获取网关发送心跳包的时间间隔(毫秒)。

public int HeartbeatIntervalMilliseconds { get; }

Property Value

int

MessageQueueProvider

获取或设置用于创建消息队列的委托。

public MessageQueueProvider MessageQueueProvider { get; set; }

Property Value

MessageQueueProvider

WebSocketProvider

获取或设置用于创建 WebSocket 客户端的委托。

public WebSocketProvider WebSocketProvider { get; set; }

Property Value

WebSocketProvider