2022-04-03 00:22:42 +00:00
|
|
|
package main
|
|
|
|
|
2023-08-10 13:30:38 +00:00
|
|
|
/*
|
|
|
|
#include <cgo_utils.h>
|
|
|
|
*/
|
|
|
|
import "C"
|
2023-10-28 23:37:53 +00:00
|
|
|
import (
|
|
|
|
"unsafe"
|
|
|
|
|
|
|
|
"github.com/waku-org/go-waku/library"
|
|
|
|
)
|
2022-04-03 00:22:42 +00:00
|
|
|
|
2023-09-29 05:13:25 +00:00
|
|
|
// Publish a message using waku lightpush. Use NULL for topic to derive the pubsub topic from the contentTopic.
|
2022-04-03 00:22:42 +00:00
|
|
|
// peerID should contain the ID of a peer supporting the lightpush protocol. Use NULL to automatically select a node
|
|
|
|
// If ms is greater than 0, the broadcast of the message must happen before the timeout
|
|
|
|
// (in milliseconds) is reached, or an error will be returned
|
2023-08-10 13:30:38 +00:00
|
|
|
//
|
|
|
|
//export waku_lightpush_publish
|
2023-10-28 23:37:53 +00:00
|
|
|
func waku_lightpush_publish(messageJSON *C.char, topic *C.char, peerID *C.char, ms C.int, cb C.WakuCallBack, userData unsafe.Pointer) C.int {
|
2023-08-10 13:30:38 +00:00
|
|
|
return singleFnExec(func() (string, error) {
|
|
|
|
return library.LightpushPublish(C.GoString(messageJSON), C.GoString(topic), C.GoString(peerID), int(ms))
|
2023-10-28 23:37:53 +00:00
|
|
|
}, cb, userData)
|
2022-04-03 00:22:42 +00:00
|
|
|
}
|