ing
This commit is contained in:
parent
824265e5a7
commit
4c113374e9
|
@ -3,17 +3,28 @@ package fasthttp
|
||||||
import (
|
import (
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
|
|
||||||
|
"git.loafle.net/commons_go/logging"
|
||||||
"git.loafle.net/commons_go/rpc/client"
|
"git.loafle.net/commons_go/rpc/client"
|
||||||
"git.loafle.net/commons_go/rpc/protocol"
|
"git.loafle.net/commons_go/rpc/protocol"
|
||||||
cwf "git.loafle.net/commons_go/websocket_fasthttp"
|
cwf "git.loafle.net/commons_go/websocket_fasthttp"
|
||||||
|
cwfc "git.loafle.net/commons_go/websocket_fasthttp/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func New() client.ClientReadWriteCloseHandler {
|
func New(socketBuilder cwfc.SocketBuilder) client.ClientReadWriteCloseHandler {
|
||||||
return &ClientReadWriteCloseHandlers{}
|
return &ClientReadWriteCloseHandlers{
|
||||||
|
SocketBuilder: socketBuilder,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClientReadWriteCloseHandlers struct {
|
type ClientReadWriteCloseHandlers struct {
|
||||||
client.ClientReadWriteCloseHandlers
|
client.ClientReadWriteCloseHandlers
|
||||||
|
|
||||||
|
SocketBuilder cwfc.SocketBuilder
|
||||||
|
}
|
||||||
|
|
||||||
|
func (crwch *ClientReadWriteCloseHandlers) Connect(clientCTX client.ClientContext) (interface{}, error) {
|
||||||
|
|
||||||
|
return cwfc.NewSocket(crwch.SocketBuilder, clientCTX)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (crwch *ClientReadWriteCloseHandlers) ReadResponse(clientCTX client.ClientContext, codec protocol.ClientCodec, conn interface{}) (protocol.ClientResponseCodec, error) {
|
func (crwch *ClientReadWriteCloseHandlers) ReadResponse(clientCTX client.ClientContext, codec protocol.ClientCodec, conn interface{}) (protocol.ClientResponseCodec, error) {
|
||||||
|
@ -50,4 +61,9 @@ func (crwch *ClientReadWriteCloseHandlers) Disconnect(clientCTX client.ClientCon
|
||||||
|
|
||||||
func (crwch *ClientReadWriteCloseHandlers) Validate() {
|
func (crwch *ClientReadWriteCloseHandlers) Validate() {
|
||||||
crwch.ClientReadWriteCloseHandlers.Validate()
|
crwch.ClientReadWriteCloseHandlers.Validate()
|
||||||
|
|
||||||
|
if nil == crwch.SocketBuilder {
|
||||||
|
logging.Logger().Panic("RPC Client: SocketBuilder must be specified")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user