ing
This commit is contained in:
11
client/central/data/client.go
Normal file
11
client/central/data/client.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
oogwc "git.loafle.net/overflow/overflow_gateway_websocket/client"
|
||||
)
|
||||
|
||||
func New() oogwc.Client {
|
||||
ch := newClientHandler()
|
||||
sb := newSocketBuilder()
|
||||
return oogwc.New(ch, sb)
|
||||
}
|
||||
30
client/central/data/client_handlers.go
Normal file
30
client/central/data/client_handlers.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.loafle.net/commons_go/logging"
|
||||
crc "git.loafle.net/commons_go/rpc/client"
|
||||
oogwc "git.loafle.net/overflow/overflow_gateway_websocket/client"
|
||||
)
|
||||
|
||||
func newClientHandler() oogwc.ClientHandler {
|
||||
ch := &ClientHandlers{}
|
||||
ch.ClientHandler = oogwc.NewClientHandler(nil)
|
||||
|
||||
return ch
|
||||
}
|
||||
|
||||
type ClientHandlers struct {
|
||||
oogwc.ClientHandler
|
||||
}
|
||||
|
||||
func (ch *ClientHandlers) Init(clientCTX crc.ClientContext) error {
|
||||
logging.Logger().Info(fmt.Sprintf("Probe Data: client has been initialized"))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ch *ClientHandlers) Destroy(clientCTX crc.ClientContext) {
|
||||
logging.Logger().Info(fmt.Sprintf("Probe Data: client has been destroyed"))
|
||||
}
|
||||
27
client/central/data/socket_builders.go
Normal file
27
client/central/data/socket_builders.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
cwfc "git.loafle.net/commons_go/websocket_fasthttp/client"
|
||||
oocmp "git.loafle.net/overflow/overflow_commons_go/modules/probe"
|
||||
oopcc "git.loafle.net/overflow/overflow_probes/client/central"
|
||||
)
|
||||
|
||||
func newSocketBuilder() cwfc.SocketBuilder {
|
||||
sb := &SocketBuilders{}
|
||||
sb.SocketBuilders = oopcc.NewSocketBuilder(oocmp.HTTPEntry_Probe)
|
||||
if nil == sb.SocketBuilders {
|
||||
return nil
|
||||
}
|
||||
sb.SocketHandler = newSocketHandler()
|
||||
|
||||
return sb
|
||||
}
|
||||
|
||||
type SocketBuilders struct {
|
||||
*oopcc.SocketBuilders
|
||||
}
|
||||
|
||||
func (sb *SocketBuilders) Validate() {
|
||||
sb.SocketBuilders.Validate()
|
||||
|
||||
}
|
||||
27
client/central/data/socket_handlers.go
Normal file
27
client/central/data/socket_handlers.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"git.loafle.net/commons_go/logging"
|
||||
cwfc "git.loafle.net/commons_go/websocket_fasthttp/client"
|
||||
)
|
||||
|
||||
type SocketHandlers struct {
|
||||
cwfc.SocketHandlers
|
||||
}
|
||||
|
||||
func (sh *SocketHandlers) OnConnect(socketContext cwfc.SocketContext, res *http.Response) {
|
||||
logging.Logger().Info(fmt.Sprintf("Probe: client has been connected res[%v]", res))
|
||||
|
||||
}
|
||||
|
||||
func (sh *SocketHandlers) OnDisconnect(soc cwfc.Socket) {
|
||||
logging.Logger().Info(fmt.Sprintf("Auth: client has been disconnected soc[%v]", soc))
|
||||
|
||||
}
|
||||
|
||||
func newSocketHandler() cwfc.SocketHandler {
|
||||
return &SocketHandlers{}
|
||||
}
|
||||
Reference in New Issue
Block a user