overflow_discovery/server/server.go
crusader 2b154aeb87 ing
2017-11-29 14:19:36 +09:00

25 lines
527 B
Go

package server
import (
cr "git.loafle.net/commons_go/rpc"
crpj "git.loafle.net/commons_go/rpc/protocol/json"
"git.loafle.net/commons_go/server"
"git.loafle.net/overflow/overflow_discovery/rpc"
)
func New(addr string) server.Server {
rpcRegistry := cr.NewRegistry()
rpc.RegisterRPC(rpcRegistry)
rpcSH := newRPCServletHandler(rpcRegistry)
rpcSH.RegisterCodec(crpj.Name, crpj.NewServerCodec())
socketHandler := newSocketHandler(rpcSH)
sh := newServerHandler(addr, socketHandler)
s := server.New(sh)
return s
}