32 lines
769 B
Go
Raw Normal View History

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