Skip to content

Commit

Permalink
Release v1.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
alyakimenko authored Sep 14, 2019
2 parents 3836131 + 185ef48 commit 07bd16f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func readSub(subscription *pubsub.Subscription, incomingMessagesChan chan pubsub
{
close(incomingMessagesChan)
close(stopChannel)
subscription.Cancel()
return
}
default:
Expand Down Expand Up @@ -256,7 +257,10 @@ func GetPeersIdentity() {

// GetTopics is method for getting subcribed topics of current peer
func GetTopics() string {
topics := handler.GetTopics()
var topics []string
for key := range subscribedTopics {
topics = append(topics, key)
}
return utils.ObjectToJSON(topics)
}

Expand Down Expand Up @@ -287,6 +291,14 @@ func GetMessages() string {

// SubscribeToTopic allows to subscribe to specific topic
func SubscribeToTopic(topic string) {
if topic == serviceTopic {
log.Println("Manual subscription to service topic is not allowed!")
return
}
if _, ok := subscribedTopics[topic]; ok {
log.Println("You are already subscribed to the topic!")
return
}
incomingMessages := make(chan pubsub.Message)
subscription, err := Pb.Subscribe(topic)
if err != nil {
Expand Down

0 comments on commit 07bd16f

Please sign in to comment.