Browse Source

Merge pull request #17 from vocdoni/pubsub_testing

explicitly import ipfs-api, declare msg before listen loop
hotfix/data-record-type
imw 5 years ago
committed by GitHub
parent
commit
6c1305115e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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/batch"
"github.com/vocdoni/dvote-relay/types" "github.com/vocdoni/dvote-relay/types"
"github.com/vocdoni/dvote-relay/data" "github.com/vocdoni/dvote-relay/data"
shell "github.com/ipfs/go-ipfs-api"
) )
func Sub(topic string) error { func Sub(topic string) error {
subscription := data.PsSubscribe(topic) subscription := data.PsSubscribe(topic)
fmt.Println("Subscribed > " + topic) fmt.Println("Subscribed > " + topic)
var msg shell.PubSubRecord
var err error
for { for {
msg, err := subscription.Next()
msg, err = subscription.Next()
if err != nil { if err != nil {
return err return err
} }

Loading…
Cancel
Save