This commit is contained in:
crusader 2017-12-01 16:02:55 +09:00
parent 2103ea902f
commit f1974f7197
3 changed files with 22 additions and 11 deletions

View File

@ -1,15 +1,24 @@
package client package client
import ( import (
"git.loafle.net/commons_go/rpc/client" crc "git.loafle.net/commons_go/rpc/client"
crcrwf "git.loafle.net/commons_go/rpc/client/rwc/websocket/fasthttp" crcrwf "git.loafle.net/commons_go/rpc/client/rwc/websocket/fasthttp"
cwfc "git.loafle.net/commons_go/websocket_fasthttp/client" cwfc "git.loafle.net/commons_go/websocket_fasthttp/client"
) )
func New(clientHandler ClientHandler, socketBuilder cwfc.SocketBuilder) client.Client { func New(clientHandler ClientHandler, socketBuilder cwfc.SocketBuilder) Client {
cRWCHandler := crcrwf.New(socketBuilder) cRWCHandler := crcrwf.New(socketBuilder)
c := client.New(clientHandler, cRWCHandler) c := &client{}
c.Client = crc.New(clientHandler, cRWCHandler)
return c return c
} }
type Client interface {
crc.Client
}
type client struct {
crc.Client
}

View File

@ -1,7 +1,9 @@
package client package client
import "git.loafle.net/commons_go/rpc/client" import (
crc "git.loafle.net/commons_go/rpc/client"
)
type ClientHandler interface { type ClientHandler interface {
client.ClientHandler crc.ClientHandler
} }

View File

@ -1,19 +1,19 @@
package client package client
import ( import (
"git.loafle.net/commons_go/rpc" cr "git.loafle.net/commons_go/rpc"
"git.loafle.net/commons_go/rpc/client" crc "git.loafle.net/commons_go/rpc/client"
"git.loafle.net/commons_go/rpc/protocol/json" crpj "git.loafle.net/commons_go/rpc/protocol/json"
) )
func NewClientHandler(registry rpc.Registry) ClientHandler { func NewClientHandler(registry cr.Registry) ClientHandler {
ch := &ClientHandlers{} ch := &ClientHandlers{}
ch.RPCRegistry = registry ch.RPCRegistry = registry
ch.Codec = json.NewClientCodec() ch.Codec = crpj.NewClientCodec()
return ch return ch
} }
type ClientHandlers struct { type ClientHandlers struct {
client.ClientHandlers crc.ClientHandlers
} }