Browse Source

explicitly import ipfs-api, declare msg before listen loop

pubsub_testing
imw 5 years ago
parent
commit
435359e233
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      net/net.go

+ 4
- 1
net/net.go

@ -6,14 +6,17 @@ import (
"github.com/vocdoni/dvote-relay/batch"
"github.com/vocdoni/dvote-relay/types"
"github.com/vocdoni/dvote-relay/data"
shell "github.com/ipfs/go-ipfs-api"
)
func Sub(topic string) error {
subscription := data.PsSubscribe(topic)
fmt.Println("Subscribed > " + topic)
var msg shell.PubSubRecord
var err error
for {
msg, err := subscription.Next()
msg, err = subscription.Next()
if err != nil {
return err
}

Loading…
Cancel
Save