From 24532a16bb0b2ae3c3c3d54baacf47afd418dc81 Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 29 Nov 2017 21:24:39 +0900 Subject: [PATCH] ing --- client/client.go | 5 +++-- client/client_rwc_handlers.go | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 client/client_rwc_handlers.go diff --git a/client/client.go b/client/client.go index 6751b83..b9edbc8 100644 --- a/client/client.go +++ b/client/client.go @@ -3,13 +3,14 @@ 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" ) func New(addr string, registry rpc.Registry) client.Client { ch := NewClientHandler(addr, registry) - - c := client.New(ch) + cRWCHandler := crcrwf.New() + c := client.New(ch, cRWCHandler) return c } diff --git a/client/client_rwc_handlers.go b/client/client_rwc_handlers.go new file mode 100644 index 0000000..13d3fc7 --- /dev/null +++ b/client/client_rwc_handlers.go @@ -0,0 +1,36 @@ +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() { + +}