diff --git a/client/client.go b/client/client.go index b9edbc8..3040ca3 100644 --- a/client/client.go +++ b/client/client.go @@ -1,16 +1,15 @@ package client import ( - "git.loafle.net/commons_go/rpc" "git.loafle.net/commons_go/rpc/client" crcrwf "git.loafle.net/commons_go/rpc/client/rwc/websocket/fasthttp" + cwfc "git.loafle.net/commons_go/websocket_fasthttp/client" ) -func New(addr string, registry rpc.Registry) client.Client { +func New(clientHandler ClientHandler, socketBuilder cwfc.SocketBuilder) client.Client { + cRWCHandler := crcrwf.New(socketBuilder) - ch := NewClientHandler(addr, registry) - cRWCHandler := crcrwf.New() - c := client.New(ch, cRWCHandler) + c := client.New(clientHandler, cRWCHandler) return c } diff --git a/client/client_handlers.go b/client/client_handlers.go index 0e242ed..f872129 100644 --- a/client/client_handlers.go +++ b/client/client_handlers.go @@ -1,16 +1,13 @@ package client import ( - "net" - "git.loafle.net/commons_go/rpc" "git.loafle.net/commons_go/rpc/client" "git.loafle.net/commons_go/rpc/protocol/json" ) -func NewClientHandler(addr string, registry rpc.Registry) ClientHandler { +func NewClientHandler(registry rpc.Registry) ClientHandler { ch := &ClientHandlers{} - ch.addr = addr ch.RPCRegistry = registry ch.Codec = json.NewClientCodec() @@ -19,10 +16,4 @@ func NewClientHandler(addr string, registry rpc.Registry) ClientHandler { type ClientHandlers struct { client.ClientHandlers - - addr string -} - -func (ch *ClientHandlers) Connect() (net.Conn, error) { - return net.Dial("unix", ch.addr) } diff --git a/client/client_rwc_handlers.go b/client/client_rwc_handlers.go deleted file mode 100644 index 13d3fc7..0000000 --- a/client/client_rwc_handlers.go +++ /dev/null @@ -1,36 +0,0 @@ -package client - -import ( - "fmt" - "net/http" - "net/url" - - crcrwf "git.loafle.net/commons_go/rpc/client/rwc/websocket/fasthttp" - "git.loafle.net/commons_go/websocket_fasthttp/websocket" -) - -type ClientReadWriteCloseHandlers struct { - crcrwf.ClientReadWriteCloseHandlers - - Scheme string - Host string - Path string -} - -func (crwch *ClientReadWriteCloseHandlers) Connect() (interface{}, error) { - u := url.URL{ - Scheme: crwch.Scheme, - Host: crwch.Host, - Path: crwch.Path, - } - var reqHeader http.Header - reqHeader.Add("", "") - - conn, res, err := websocket.DefaultDialer.Dial(u.String(), reqHeader) - - return nil, fmt.Errorf("RPC Client RWC Handler: ClientHandlers method[Connect] is not implement") -} - -func (crwch *ClientReadWriteCloseHandlers) Validate() { - -}