overflow_probes/client/central/probe/socket_handlers.go
crusader fb7d1ca4d6 ing
2017-12-08 17:31:45 +09:00

32 lines
841 B
Go

package probe
import (
"fmt"
"net/http"
"git.loafle.net/commons_go/logging"
cwfc "git.loafle.net/commons_go/websocket_fasthttp/client"
oocmp "git.loafle.net/overflow/overflow_commons_go/modules/probe"
"git.loafle.net/overflow/overflow_probes/config"
)
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))
encryptionKey := res.Header.Get(oocmp.HTTPResponseHeaderKey_Probe_SetEncryptionKey)
config.EncryptionKey = &encryptionKey
}
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{}
}