supersockets支持热更新的服务器实例配置选项

本文详细介绍了SuperSocket中配置选项的热更新功能,包括logCommand、idleSessionTimeOut等参数,并通过PushServer项目的示例代码展示了如何实现自定义配置属性的热更新。

SuperSocket 支持以下配置选项的热更新:

* logCommand

* idleSessionTimeOut

* maxRequestLength

* logBasicSessionActivity

* logAllSocketException

SuperSocket 支持所有自定义配置属性和自定义配置子节点的热更新。

下面的代码将演示如何让你的自定义配置支持热更新:

public class PushServer : AppServer

{

    private int m_Interval;

 

    protected override bool Setup(IRootConfig rootConfig, IServerConfig config)

    {

        RegisterConfigHandler(config, "pushInterval", (value) =>

            {

                // the code in this scope will be executed automatically

                // after the configuration attribute "pushInterval" is changed

 

                var interval = 0;

                int.TryParse(value, out interval);

 

                if (interval <= 0)

                    interval = 60;// 60 seconds by default

 

                m_Interval = interval * 1000;

                return true;

            });

 

        return true;

    }

 

    /// Other code

}

你可以在QuickStart中的 PushServer 项目中找到此更能的完整示例代码。

转载于:https://www.cnblogs.com/fanweisheng/p/11126925.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值