关键字: 连接事件, 断开事件, OnSessionStarted,OnSessionClosed, NewSessionConnected, SessionClosed

AppSession 的虚方法 OnSessionStarted() 和 OnSessionClosed(CloseReason reason)

 

你可以覆盖基类的虚方法 OnSessionStarted() 和 OnSessionClosed(CloseReason reason) 用于在会话连接和断开时执行一些逻辑操作:

public class TelnetSession : AppSession<TelnetSession>

{

    protected override void OnSessionStarted()

    {

        this.Send("Welcome to SuperSocket Telnet Server");

        //add your business operations

    }

 

    protected override void OnSessionClosed(CloseReason reason)

    {

        //add your business operations

    }

}

相关文章:

  • 2022-01-31
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2021-05-23
  • 2021-12-29
猜你喜欢
  • 2022-12-23
  • 2021-08-08
  • 2021-07-19
  • 2021-09-11
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
相关资源
相似解决方案