member_gateway_rpc/server/server.go

32 lines
769 B
Go
Raw Permalink Normal View History

2018-04-06 13:01:28 +00:00
package server
import (
2018-06-30 17:32:51 +00:00
crc "git.loafle.net/commons/rpc-go/codec"
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-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-06-30 17:32:51 +00:00
ws.RPCServerCodec = crpj.NewCustomServerCodec(crc.NewCompressionCodecSelector(_config.ServerHandler.GetCompressionThreshold()))
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
}