delete subscriber_handler
This commit is contained in:
parent
309dd9ceb5
commit
7b033878f0
|
@ -1,34 +0,0 @@
|
||||||
package data
|
|
||||||
|
|
||||||
import (
|
|
||||||
"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"
|
|
||||||
oos "git.loafle.net/overflow/overflow_subscriber"
|
|
||||||
)
|
|
||||||
|
|
||||||
func newSubscriberHandler(servletHandler oogws.ServletHandler) oogwsub.SubscriberHandler {
|
|
||||||
sh := &SubscriberHandlers{}
|
|
||||||
sh.ServletHandler = servletHandler
|
|
||||||
sh.Channel = cfg.Entry
|
|
||||||
|
|
||||||
return sh
|
|
||||||
}
|
|
||||||
|
|
||||||
type SubscriberHandlers struct {
|
|
||||||
oogwsub.SubscriberHandlers
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sh *SubscriberHandlers) Validate() {
|
|
||||||
sh.SubscriberHandlers.Validate()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user