|
@ -16,19 +16,20 @@ func main() { |
|
|
fmt.Printf("%v\n", err) |
|
|
fmt.Printf("%v\n", err) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
key := "randomkey0" |
|
|
|
|
|
sn.PssSub("sym", key, "vocdoni_test", "") |
|
|
|
|
|
|
|
|
key := os.Args[1] |
|
|
|
|
|
topic := "vocdoni_test" |
|
|
|
|
|
|
|
|
|
|
|
sn.PssSub("asym", key, topic, "") |
|
|
go func() { |
|
|
go func() { |
|
|
for { |
|
|
for { |
|
|
msg := <-sn.PssTopics["vocdoni_test"].Delivery |
|
|
|
|
|
|
|
|
msg := <-sn.PssTopics[topic].Delivery |
|
|
fmt.Printf("Pss received: %s\n", msg) |
|
|
fmt.Printf("Pss received: %s\n", msg) |
|
|
} |
|
|
} |
|
|
}() |
|
|
}() |
|
|
|
|
|
|
|
|
hostname, _ := os.Hostname() |
|
|
hostname, _ := os.Hostname() |
|
|
for { |
|
|
for { |
|
|
err := sn.PssPub("sym", key, "vocdoni_test", fmt.Sprintf("Hello world from %s", hostname), "") |
|
|
|
|
|
|
|
|
err := sn.PssPub("asym", key, topic, fmt.Sprintf("Hello world from %s", hostname), "") |
|
|
log.Info("pss sent", "err", err) |
|
|
log.Info("pss sent", "err", err) |
|
|
time.Sleep(10 * time.Second) |
|
|
time.Sleep(10 * time.Second) |
|
|
} |
|
|
} |
|
|