post waku relay message error handling

This commit is contained in:
Oskar Thoren 2021-06-10 20:34:39 +08:00
parent 8f30fa1463
commit a4ee858607
No known key found for this signature in database
GPG Key ID: B2ECCFD3BC2EF77E
2 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ func main() {
// Publish
var message = nwaku.WakuRelayMessage{Payload: "0x1a2b3c4d5e6f", ContentTopic: contentTopic}
var res = nwaku.PostWakuRelayMessage(client, message)
var res, _ = nwaku.PostWakuRelayMessage(client, message)
fmt.Println("Publish", res)
<-nodeStopped

View File

@ -28,15 +28,15 @@ func GetWakuStoreMessages(client *rpc.Client, contentTopic string) (StoreRespons
}
func PostWakuRelayMessage(client *rpc.Client, message WakuRelayMessage) bool {
func PostWakuRelayMessage(client *rpc.Client, message WakuRelayMessage) (bool, error) {
var topic = "/waku/2/default-waku/proto"
var res bool
if err := client.Call(&res, "post_waku_v2_relay_v1_message", topic, message); err != nil {
panic(err)
return res, err
}
return res
return res, nil
}
// TODO Subscribe, then poll for getting messages