Пример #1
0
func (s *Service) registerAdditional(bus *pubsub.PubSub, topic string, handler MailboxHandler, mb chan *pubsub.Mailbox) {
	bus.AddSub(mb, topic)
	s.registry[topic] = handler
}
Пример #2
0
func Notify(bus *pubsub.PubSub, topic, text string) {
	mlog.Info(text)
	payload := &dto.Packet{Topic: topic, Payload: text}
	// payload := &dto.Packet{Topic: topic, Payload: text}
	bus.Pub(&pubsub.Message{Payload: payload}, "socket:connections:broadcast")
}
Пример #3
0
func (s *Service) register(bus *pubsub.PubSub, topic string, handler MailboxHandler) (mbox chan *pubsub.Mailbox) {
	mbox = bus.Sub(topic)
	s.registry[topic] = handler
	return mbox
}