2017-11-14 10:10:28 +00:00
|
|
|
package web
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"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 (
|
|
|
|
Name = "web"
|
|
|
|
)
|
|
|
|
|
|
|
|
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 {
|
|
|
|
logging.Logger().Panic(fmt.Sprintf("Webapp: config of servlet[%s] is not exist", Name))
|
|
|
|
}
|
|
|
|
|
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() {
|
|
|
|
|
|
|
|
}
|