mirror of https://github.com/waku-org/nwaku.git
refactor(relay): simplify relay publish jsonrpc api
This commit is contained in:
parent
028efc8547
commit
b84c54bbcb
|
@ -364,8 +364,7 @@ proc publish*(node: WakuNode, topic: PubsubTopic, message: WakuMessage) {.async,
|
||||||
|
|
||||||
trace "publish", topic=topic, contentTopic=message.contentTopic
|
trace "publish", topic=topic, contentTopic=message.contentTopic
|
||||||
|
|
||||||
let data = message.encode().buffer
|
discard await node.wakuRelay.publish(topic, message)
|
||||||
discard await node.wakuRelay.publish(topic, data)
|
|
||||||
|
|
||||||
proc startRelay*(node: WakuNode) {.async.} =
|
proc startRelay*(node: WakuNode) {.async.} =
|
||||||
## Setup and start relay protocol
|
## Setup and start relay protocol
|
||||||
|
|
|
@ -147,10 +147,10 @@ method publish*(w: WakuRelay, pubsubTopic: PubsubTopic, message: WakuMessage|seq
|
||||||
|
|
||||||
var data: seq[byte]
|
var data: seq[byte]
|
||||||
when message is WakuMessage:
|
when message is WakuMessage:
|
||||||
data = message.encode()
|
data = message.encode().buffer
|
||||||
else:
|
else:
|
||||||
data = message
|
data = message
|
||||||
|
|
||||||
return await procCall GossipSub(w).publish(pubsubTopic, message)
|
return await procCall GossipSub(w).publish(pubsubTopic, data)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue