func (m *RedisPubSub) Publish(fromID, key string) error {
	return m.client.Publish(m.channel, fromID+"$"+key).Err()
}
Publish publishes provided message to channel provided on new RedisPubSub instance creation
package eventbus
import (
	"strings"
	"time"
	"github.com/go-redis/redis/v7"
	"github.com/hashicorp/go-multierror"
	"github.com/pkg/errors"
)
func NewRedisPubSub(addr, channel string) (*RedisPubSub, error) {
	client := redis.NewClient(&redis.Options{Addr: addr})
	pubSub := client.Subscribe(channel)
	if _, err := pubSub.Receive(); err != nil {
		_ = client.Close()
		return nil, errors.Wrapf(err, "problem subscribing to channel %s on address %s", channel, addr)
	}
	return &RedisPubSub{client: client, pubSub: pubSub, channel: channel, done: make(chan struct{})}, nil
}
type RedisPubSub struct {
	client  *redis.Client
	pubSub  *redis.PubSub
	channel string
	done chan struct{}
}
func (m *RedisPubSub) Subscribe(fn func(fromID, key string)) error {
	go func(done <-chan struct{}, pubsub *redis.PubSub) {
		for {
			select {
			case <-done:
				return
			default:
			}
			msg, err := pubsub.ReceiveTimeout(time.Second * 10)
			if err != nil {
				continue
			}
			if msg, ok := msg.(*redis.Message); ok {
				payload := strings.Split(msg.Payload, "$")
				fn(payload[0], strings.Join(payload[1:], "$"))
			}
		}
	}(m.done, m.pubSub)
	return nil
}