fix/content-type-int (#235)

* fixes

* fixes

* using a better topic

* fix

* fixed
This commit is contained in:
Dean Eigenmann
2020-10-21 16:55:06 +08:00
committed by GitHub
parent b2edfe8dda
commit 5ddd8701c9
9 changed files with 37 additions and 25 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ proc runBackground() {.async.} =
# Publish to a topic
let payload = cast[seq[byte]]("hello world")
let message = WakuMessage(payload: payload, contentTopic: "foo")
let message = WakuMessage(payload: payload, contentTopic: ContentTopic(1))
node.publish(topic, message)
# TODO Await with try/except here
+4 -2
View File
@@ -3,7 +3,7 @@ when not(compileOption("threads")):
import std/[tables, strformat, strutils]
import confutils, chronicles, chronos, stew/shims/net as stewNet,
eth/keys, bearssl
eth/keys, bearssl, stew/[byteutils, endians2]
import libp2p/[switch, # manage transports, a single entry point for dialing and listening
multistream, # tag stream with short header to identify it
crypto/crypto, # cryptographic functions
@@ -31,7 +31,9 @@ const Help = """
"""
const DefaultTopic = "waku"
const DefaultContentTopic = "dingpu"
const Dingpu = "dingpu".toBytes
const DefaultContentTopic = ContentTopic(uint32.fromBytes(Dingpu))
# XXX Connected is a bit annoying, because incoming connections don't trigger state change
# Could poll connection pool or something here, I suppose