ing
This commit is contained in:
parent
d747c231f8
commit
f5f56d2924
|
@ -7,6 +7,7 @@ import (
|
|||
cwf "git.loafle.net/commons_go/websocket_fasthttp"
|
||||
oocmp "git.loafle.net/overflow/overflow_commons_go/modules/probe"
|
||||
probeM "git.loafle.net/overflow/overflow_commons_go/modules/probe/model"
|
||||
oogw "git.loafle.net/overflow/overflow_gateway_websocket"
|
||||
oogweg "git.loafle.net/overflow/overflow_gateway_websocket/external/grpc"
|
||||
"git.loafle.net/overflow/overflow_gateway_websocket/rpc"
|
||||
// jwt "github.com/dgrijalva/jwt-go"
|
||||
|
@ -82,6 +83,9 @@ func (sh *GatewayRPCHandlers) Handshake(socketCTX cwf.SocketContext, ctx *fastht
|
|||
extensionsHeader = &fasthttp.ResponseHeader{}
|
||||
extensionsHeader.Add(oocmp.HTTPResponseHeaderKey_Probe_SetEncryptionKey, probe.EncryptionKey)
|
||||
|
||||
socketCTX.SetAttribute(oogw.ClientTypeKey, oogw.PROBE)
|
||||
socketCTX.SetAttribute(oogw.TargetIDKey, probeKey)
|
||||
|
||||
return probeKey, extensionsHeader
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package probe
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.loafle.net/commons_go/logging"
|
||||
"git.loafle.net/commons_go/websocket_fasthttp/websocket"
|
||||
oogws "git.loafle.net/overflow/overflow_gateway_websocket/servlet"
|
||||
oogwsub "git.loafle.net/overflow/overflow_gateway_websocket/subscribe"
|
||||
|
@ -20,15 +23,18 @@ type SubscriberHandlers struct {
|
|||
}
|
||||
|
||||
func (sh *SubscriberHandlers) OnSubscribe(channel string, message oos.SubscribeMessage) {
|
||||
for _, uid := range message.Targets {
|
||||
if soc := sh.GetSocket(uid); nil != soc {
|
||||
soc.WriteMessage(websocket.TextMessage, message.Message)
|
||||
switch message.TargetType {
|
||||
case oos.PROBE:
|
||||
for _, pid := range message.Targets {
|
||||
if soc := sh.GetSocket(pid); nil != soc {
|
||||
soc.WriteMessage(websocket.TextMessage, message.Message)
|
||||
}
|
||||
}
|
||||
default:
|
||||
logging.Logger().Warn(fmt.Sprintf("[PROBE] SubscriberHandler: Unknown TargetType %s", message.TargetType))
|
||||
}
|
||||
}
|
||||
|
||||
func (sh *SubscriberHandlers) Validate() {
|
||||
sh.SubscriberHandlers.Validate()
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user