mirror of
https://github.com/status-im/nim-json-rpc.git
synced 2025-02-24 10:18:15 +00:00
Move start, stop and close to transport specific sockettransport
This commit is contained in:
parent
f943c584c7
commit
9075b967d1
@ -134,21 +134,6 @@ proc processMessages*[T](server: RpcServer[T], line: string): Future[string] {.a
|
||||
error = wrapError(METHOD_NOT_FOUND, "Method not found", id, methodNotFound)
|
||||
result = $wrapReply(id, newJNull(), error)
|
||||
|
||||
proc start*(server: RpcServer) =
|
||||
## Start the RPC server.
|
||||
for item in server.servers:
|
||||
item.start()
|
||||
|
||||
proc stop*(server: RpcServer) =
|
||||
## Stop the RPC server.
|
||||
for item in server.servers:
|
||||
item.stop()
|
||||
|
||||
proc close*(server: RpcServer) =
|
||||
## Cleanup resources of RPC server.
|
||||
for item in server.servers:
|
||||
item.close()
|
||||
|
||||
# Server registration
|
||||
|
||||
proc register*(server: RpcServer, name: string, rpc: RpcProc) =
|
||||
|
@ -140,3 +140,17 @@ proc newRpcStreamServer*(address = "localhost", port: Port = Port(8545)): RpcStr
|
||||
result = newRpcServer[StreamServer]()
|
||||
result.addStreamServer(address, port)
|
||||
|
||||
proc start*(server: RpcStreamServer) =
|
||||
## Start the RPC server.
|
||||
for item in server.servers:
|
||||
item.start()
|
||||
|
||||
proc stop*(server: RpcStreamServer) =
|
||||
## Stop the RPC server.
|
||||
for item in server.servers:
|
||||
item.stop()
|
||||
|
||||
proc close*(server: RpcStreamServer) =
|
||||
## Cleanup resources of RPC server.
|
||||
for item in server.servers:
|
||||
item.close()
|
Loading…
x
Reference in New Issue
Block a user