This commit is contained in:
crusader 2017-11-29 21:24:39 +09:00
parent d430a13a76
commit 24532a16bb
2 changed files with 39 additions and 2 deletions

View File

@ -3,13 +3,14 @@ package client
import ( import (
"git.loafle.net/commons_go/rpc" "git.loafle.net/commons_go/rpc"
"git.loafle.net/commons_go/rpc/client" "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 { func New(addr string, registry rpc.Registry) client.Client {
ch := NewClientHandler(addr, registry) ch := NewClientHandler(addr, registry)
cRWCHandler := crcrwf.New()
c := client.New(ch) c := client.New(ch, cRWCHandler)
return c return c
} }

View File

@ -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() {
}