Skip to content

Commit

Permalink
postmaster topic v2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SunilSKamath4s committed Feb 8, 2023
1 parent 5655e48 commit 2f4bfab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion protocols/pub/pubnub/pubnub.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (
type Config struct {
SubscribeKey string
PublishKey string
SecretKey string
}

func (c *Config) GetKeys() []string {
return []string{"subscribe_key", "publish_key"}
return []string{"subscribe_key", "publish_key", "secret_key"}
}

func (c *Config) GetMandatoryKeys() []string {
Expand All @@ -25,6 +26,8 @@ func (c *Config) GetField(key string) string {
return "SubscribeKey"
case "publish_key":
return "PublishKey"
case "secret_key":
return "SecretKey"
default:
return ""
}
Expand All @@ -48,6 +51,9 @@ func (pub *pubnubPub) Connect(configs map[string]interface{}) error {
cfg := pubnub.NewConfig()
cfg.SubscribeKey = config.SubscribeKey
cfg.PublishKey = config.PublishKey
if config.SecretKey != "" {
cfg.SecretKey = config.SecretKey
}
pub.Client = pubnub.NewPubNub(cfg)

return err
Expand Down

0 comments on commit 2f4bfab

Please sign in to comment.