2017-12-15 09:28:53 +00:00
|
|
|
package webapp
|
2017-11-14 10:10:28 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"git.loafle.net/commons_go/logging"
|
|
|
|
oogwc "git.loafle.net/overflow/overflow_gateway_websocket/config"
|
|
|
|
oogws "git.loafle.net/overflow/overflow_gateway_websocket/server"
|
2017-11-23 08:09:29 +00:00
|
|
|
oosc "git.loafle.net/overflow/overflow_server_config"
|
2017-11-14 10:10:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2017-12-15 09:28:53 +00:00
|
|
|
Name = "webapp"
|
2017-11-14 10:10:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2017-11-23 08:09:29 +00:00
|
|
|
cfg *oosc.Servlet
|
2017-11-14 10:10:28 +00:00
|
|
|
)
|
|
|
|
|
2017-11-28 11:08:46 +00:00
|
|
|
func ServletInit(sh oogws.ServerHandler) {
|
2017-11-14 10:10:28 +00:00
|
|
|
cfg = oogwc.Config.Servlets[Name]
|
|
|
|
if nil == cfg {
|
2018-03-21 11:46:47 +00:00
|
|
|
logging.Logger().Panicf("WebApp: config of servlet[%s] is not exist", Name)
|
2017-11-14 10:10:28 +00:00
|
|
|
}
|
|
|
|
|
2017-11-28 11:08:46 +00:00
|
|
|
rpcGH := newGatewayRPCHandler()
|
2017-11-14 10:10:28 +00:00
|
|
|
rpcSH := sh.RegisterRPCGatewayServlet(Name, rpcGH)
|
|
|
|
sub := newSubscriberHandler(rpcSH)
|
|
|
|
|
|
|
|
sh.RegisterSubscriber(sub)
|
|
|
|
}
|
2017-11-28 11:08:46 +00:00
|
|
|
|
|
|
|
func ServletDestroy() {
|
|
|
|
|
|
|
|
}
|