nwaku/waku/node/v2/quicksim.nim

34 lines
989 B
Nim
Raw Normal View History

import
os, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
eth/common as eth_common, eth/keys,
2020-05-27 04:07:11 +00:00
../v1/rpc/[hexstrings, rpc_types],
options as what # TODO: Huh? Redefinition?
from os import DirSep
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
const sigWakuPath = &"{sourceDir}{DirSep}rpc{DirSep}wakucallsigs.nim"
createRpcSigs(RpcHttpClient, sigWakuPath)
let node1 = newRpcHttpClient()
2020-05-22 06:25:09 +00:00
let node2 = newRpcHttpClient()
info "Hello there"
2020-05-22 04:23:41 +00:00
# portsShift=2
waitFor node1.connect("localhost", Port(8547))
2020-05-22 06:25:09 +00:00
waitFor node2.connect("localhost", Port(8548))
let version = waitFor node1.wakuVersion()
proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =
debug "Hit handler", topic=topic, data=data
# TODO: Implement handler logic
let res1 = waitFor node2.wakuSubscribe("foobar")
os.sleep(2000)
2020-05-22 07:28:51 +00:00
let res2 = waitFor node1.wakuPublish("foobar", "hello world")
os.sleep(2000)
info "Version is", version