overflow_discovery/server/server.go
crusader 62cb95bd15 ing
2017-12-01 17:29:54 +09:00

25 lines
541 B
Go

package server
import (
crpj "git.loafle.net/commons_go/rpc/protocol/json"
crr "git.loafle.net/commons_go/rpc/registry"
"git.loafle.net/commons_go/server"
"git.loafle.net/overflow/overflow_discovery/rpc"
)
func New(addr string) server.Server {
rpcRegistry := crr.NewRPCRegistry()
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
}