You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
638 B

package main
import (
"fmt"
"os"
"time"
"github.com/ethereum/go-ethereum/log"
swarm "github.com/vocdoni/go-dvote/net/swarm"
)
func main() {
sn := new(swarm.SwarmNet)
err := sn.Init()
if err != nil {
fmt.Printf("%v\n", err)
return
}
key := os.Args[1]
topic := "vocdoni_test"
sn.PssSub("asym", key, topic, "")
go func() {
for {
msg := <-sn.PssTopics[topic].Delivery
fmt.Printf("Pss received: %s\n", msg)
}
}()
hostname, _ := os.Hostname()
for {
err := sn.PssPub("asym", key, topic, fmt.Sprintf("Hello world from %s", hostname), "")
log.Info("pss sent", "err", err)
time.Sleep(10 * time.Second)
}
}