mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-15 09:26:38 +00:00
21 lines
502 B
Nim
21 lines
502 B
Nim
include ../ json_rpc / client
|
|
|
|
proc nextId*(self: RpcClient): int64 = self.nextId
|
|
|
|
proc rawCall*(self: RpcClient, name: string,
|
|
msg: string): Future[Response] {.async.} =
|
|
# For debug purposes only
|
|
let id = $self.nextId
|
|
self.nextId.inc
|
|
|
|
var s = msg & "\c\l"
|
|
let res = await self.transport.write(s)
|
|
doAssert res == len(s)
|
|
|
|
# completed by processMessage.
|
|
var newFut = newFuture[Response]()
|
|
# add to awaiting responses
|
|
self.awaiting[id] = newFut
|
|
|
|
result = await newFut
|