Skip to content

Service模块

zerlenzhang edited this page Mar 5, 2020 · 1 revision

给服务号注册服务,这样,在Netbus收到这样服务号的CmdPackage消息时,会调用这个服务的方法去处理该消息

Service.Register

  • 注册使用CmdPackage的服务

  • args:

    1. serviceType : int
    2. service : Service

`local service = {

OnSessionRecvCmd=function(session,cmdPackage)end,       // 必须

OnSessionDisconnected=function(session,serviceType)end, // 必须

OnSessionConnected=function(session,serviceType)end,    // 可选

});

Service.Register(serviceType,service);`

Service.RegisterRaw

  • 注册使用RawPackage的服务,推荐用于网关

  • args:

    1. serviceType : int
    2. service : Service

`local rawService = {

OnSessionRecvRaw=function(session,rawPackage)end,       // 必须

OnSessionDisconnected=function(session,serviceType)end, // 必须

OnSessionConnected=function(session,serviceType)end,    // 可选

});

Service.RegisterRaw(serviceType,rawService );`

Clone this wiki locally