|
@ -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 |
|
|
} |
|
|
} |
|
|