ing
This commit is contained in:
parent
afd49dd0dc
commit
210cdfec3f
|
@ -9,6 +9,12 @@ import (
|
|||
"git.loafle.net/commons_go/server"
|
||||
)
|
||||
|
||||
func New(address string) client.ClientReadWriteCloseHandler {
|
||||
return &ClientReadWriteCloseHandlers{
|
||||
Address: address,
|
||||
}
|
||||
}
|
||||
|
||||
type ClientReadWriteCloseHandlers struct {
|
||||
client.ClientReadWriteCloseHandlers
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@ import (
|
|||
cwf "git.loafle.net/commons_go/websocket_fasthttp"
|
||||
)
|
||||
|
||||
func New() client.ClientReadWriteCloseHandler {
|
||||
return &ClientReadWriteCloseHandlers{}
|
||||
}
|
||||
|
||||
type ClientReadWriteCloseHandlers struct {
|
||||
client.ClientReadWriteCloseHandlers
|
||||
}
|
||||
|
|
|
@ -6,18 +6,22 @@ import (
|
|||
"git.loafle.net/commons_go/server"
|
||||
)
|
||||
|
||||
type ServletReadWriteCloseHandler struct {
|
||||
rpc.ServletReadWriteCloseHandler
|
||||
func New() rpc.ServletReadWriteCloseHandler {
|
||||
return &ServletReadWriteCloseHandlers{}
|
||||
}
|
||||
|
||||
func (srwch *ServletReadWriteCloseHandler) ReadRequest(servletCTX rpc.ServletContext, codec protocol.ServerCodec, conn interface{}) (protocol.ServerRequestCodec, error) {
|
||||
type ServletReadWriteCloseHandlers struct {
|
||||
rpc.ServletReadWriteCloseHandlers
|
||||
}
|
||||
|
||||
func (srwch *ServletReadWriteCloseHandlers) ReadRequest(servletCTX rpc.ServletContext, codec protocol.ServerCodec, conn interface{}) (protocol.ServerRequestCodec, error) {
|
||||
soc := conn.(server.Socket)
|
||||
reqCodec, err := codec.NewRequest(soc)
|
||||
|
||||
return reqCodec, err
|
||||
}
|
||||
|
||||
func (srwch *ServletReadWriteCloseHandler) WriteResponse(servletCTX rpc.ServletContext, conn interface{}, reqCodec protocol.ServerRequestCodec, result interface{}, err error) error {
|
||||
func (srwch *ServletReadWriteCloseHandlers) WriteResponse(servletCTX rpc.ServletContext, conn interface{}, reqCodec protocol.ServerRequestCodec, result interface{}, err error) error {
|
||||
soc := conn.(server.Socket)
|
||||
|
||||
if nil != err {
|
||||
|
@ -33,7 +37,7 @@ func (srwch *ServletReadWriteCloseHandler) WriteResponse(servletCTX rpc.ServletC
|
|||
return nil
|
||||
}
|
||||
|
||||
func (srwch *ServletReadWriteCloseHandler) WriteNotification(servletCTX rpc.ServletContext, conn interface{}, codec protocol.ServerCodec, method string, params interface{}) error {
|
||||
func (srwch *ServletReadWriteCloseHandlers) WriteNotification(servletCTX rpc.ServletContext, conn interface{}, codec protocol.ServerCodec, method string, params interface{}) error {
|
||||
soc := conn.(server.Socket)
|
||||
|
||||
if wErr := codec.WriteNotification(soc, method, params); nil != wErr {
|
||||
|
|
|
@ -7,11 +7,15 @@ import (
|
|||
"git.loafle.net/commons_go/websocket_fasthttp/websocket"
|
||||
)
|
||||
|
||||
type ServletReadWriteCloseHandler struct {
|
||||
rpc.ServletReadWriteCloseHandler
|
||||
func New() rpc.ServletReadWriteCloseHandler {
|
||||
return &ServletReadWriteCloseHandlers{}
|
||||
}
|
||||
|
||||
func (srwch *ServletReadWriteCloseHandler) ReadRequest(servletCTX rpc.ServletContext, codec protocol.ServerCodec, conn interface{}) (protocol.ServerRequestCodec, error) {
|
||||
type ServletReadWriteCloseHandlers struct {
|
||||
rpc.ServletReadWriteCloseHandlers
|
||||
}
|
||||
|
||||
func (srwch *ServletReadWriteCloseHandlers) ReadRequest(servletCTX rpc.ServletContext, codec protocol.ServerCodec, conn interface{}) (protocol.ServerRequestCodec, error) {
|
||||
soc := conn.(cwf.Socket)
|
||||
_, r, err := soc.NextReader()
|
||||
|
||||
|
@ -20,7 +24,7 @@ func (srwch *ServletReadWriteCloseHandler) ReadRequest(servletCTX rpc.ServletCon
|
|||
return requestCodec, err
|
||||
}
|
||||
|
||||
func (srwch *ServletReadWriteCloseHandler) WriteResponse(servletCTX rpc.ServletContext, conn interface{}, requestCodec protocol.ServerRequestCodec, result interface{}, err error) error {
|
||||
func (srwch *ServletReadWriteCloseHandlers) WriteResponse(servletCTX rpc.ServletContext, conn interface{}, requestCodec protocol.ServerRequestCodec, result interface{}, err error) error {
|
||||
soc := conn.(cwf.Socket)
|
||||
|
||||
wc, wErr := soc.NextWriter(websocket.TextMessage)
|
||||
|
@ -41,7 +45,7 @@ func (srwch *ServletReadWriteCloseHandler) WriteResponse(servletCTX rpc.ServletC
|
|||
return nil
|
||||
}
|
||||
|
||||
func (srwch *ServletReadWriteCloseHandler) WriteNotification(servletCTX rpc.ServletContext, conn interface{}, codec protocol.ServerCodec, method string, args []interface{}) error {
|
||||
func (srwch *ServletReadWriteCloseHandlers) WriteNotification(servletCTX rpc.ServletContext, conn interface{}, codec protocol.ServerCodec, method string, params interface{}) error {
|
||||
soc := conn.(cwf.Socket)
|
||||
|
||||
wc, wErr := soc.NextWriter(websocket.TextMessage)
|
||||
|
@ -49,7 +53,7 @@ func (srwch *ServletReadWriteCloseHandler) WriteNotification(servletCTX rpc.Serv
|
|||
return wErr
|
||||
}
|
||||
|
||||
if wErr := codec.WriteNotification(wc, method, args); nil != wErr {
|
||||
if wErr := codec.WriteNotification(wc, method, params); nil != wErr {
|
||||
return wErr
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user