mirror of
https://github.com/status-im/nim-json-rpc.git
synced 2025-02-24 18:28:10 +00:00
Add rpc server init proc
This commit is contained in:
parent
746232a928
commit
bdf47fd2ed
@ -58,6 +58,11 @@ const
|
||||
(INVALID_REQUEST, "No id specified")
|
||||
]
|
||||
|
||||
proc newRpcServer*[T]: RpcServer[T] =
|
||||
result = RpcServer[T]()
|
||||
result.procs = newTable[string, RpcProc]()
|
||||
result.servers = @[]
|
||||
|
||||
# Utility functions
|
||||
# TODO: Move outside server
|
||||
func `%`*(p: Port): JsonNode = %(p.int)
|
||||
|
@ -11,9 +11,7 @@ type RpcStreamServer* = RpcServer[StreamServer]
|
||||
|
||||
proc newRpcStreamServer*(addresses: openarray[TransportAddress]): RpcStreamServer =
|
||||
## Create new server and assign it to addresses ``addresses``.
|
||||
result = RpcServer[StreamServer]()
|
||||
result.procs = newTable[string, RpcProc]()
|
||||
result.servers = newSeq[StreamServer]()
|
||||
result = newRpcServer[StreamServer]()
|
||||
|
||||
for item in addresses:
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user