2018-04-06 13:01:28 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2018-05-08 10:14:02 +00:00
|
|
|
crpj "git.loafle.net/commons/rpc-go/protocol/json"
|
2018-04-09 13:37:03 +00:00
|
|
|
csgw "git.loafle.net/commons/server-go/socket/web"
|
2018-04-10 06:03:15 +00:00
|
|
|
"git.loafle.net/overflow/member_gateway_rpc/config"
|
2018-04-06 13:01:28 +00:00
|
|
|
"git.loafle.net/overflow/member_gateway_rpc/servlet"
|
|
|
|
)
|
|
|
|
|
2018-04-11 13:08:56 +00:00
|
|
|
func New(_config *config.Config) *csgw.Server {
|
2018-05-08 10:14:02 +00:00
|
|
|
rpcServerCodec := crpj.NewServerCodec()
|
|
|
|
|
2018-04-11 08:33:23 +00:00
|
|
|
ws := &servlet.WebappServlets{
|
2018-04-11 13:08:56 +00:00
|
|
|
VerifyKey: _config.VerifyKey,
|
2018-04-11 14:38:30 +00:00
|
|
|
SignKey: _config.SignKey,
|
2018-04-11 08:33:23 +00:00
|
|
|
}
|
2018-05-08 10:14:02 +00:00
|
|
|
ws.RPCServerCodec = rpcServerCodec
|
2018-04-13 12:20:16 +00:00
|
|
|
ws.UseSession = true
|
|
|
|
|
2018-04-10 06:03:15 +00:00
|
|
|
sh := &ServerHandlers{
|
|
|
|
ServerHandlers: *_config.ServerHandler,
|
|
|
|
Config: _config,
|
|
|
|
}
|
|
|
|
|
2018-04-09 13:37:03 +00:00
|
|
|
sh.RegisterServlet("/webapp", ws)
|
2018-04-06 13:01:28 +00:00
|
|
|
|
2018-04-09 13:37:03 +00:00
|
|
|
s := &csgw.Server{
|
2018-04-06 13:01:28 +00:00
|
|
|
ServerHandler: sh,
|
|
|
|
}
|
|
|
|
|
|
|
|
return s
|
|
|
|
}
|