mirror of
https://github.com/codex-storage/nim-json-rpc.git
synced 2025-02-23 16:38:22 +00:00
Change example to invoke `rpc from within procedure scope
This commit is contained in:
parent
8b1b933d5d
commit
db55114233
@ -5,11 +5,14 @@ var srv = newRpcServer()
|
||||
srv.address = "localhost"
|
||||
srv.port = Port(8545)
|
||||
|
||||
srv.rpc("myProc") do(input: string, data: array[0..3, int]):
|
||||
result = %("Hello " & input & " data: " & $data)
|
||||
proc makeProc(server: var RpcServer) =
|
||||
server.rpc("myProc") do(input: string, data: array[0..3, int]):
|
||||
result = %("Hello " & input & " data: " & $data)
|
||||
|
||||
asyncCheck srv.serve
|
||||
|
||||
srv.makeProc
|
||||
|
||||
suite "Server/Client RPC":
|
||||
proc main {.async.} =
|
||||
var client = newRpcClient()
|
||||
|
Loading…
x
Reference in New Issue
Block a user