This commit is contained in:
2025-09-17 09:07:03 +02:00
parent d94d226ca5
commit 56db4a17ab
2 changed files with 77 additions and 69 deletions

View File

@@ -2,6 +2,8 @@
import freeflowuniverse.herolib.hero.heromodels.rpc
// when httpport is set, the rpc will be available over http
// if 0, then its only available on unix socket /tmp/heromodels
mut http_port := 9933
if http_port == 0 {
@@ -14,13 +16,19 @@ if http_port == 0 {
nc -U /tmp/heromodels
then e.g. do
then e.g. do
\{"jsonrpc":"2.0","method":"comment_set","params":{"comment":"Hello world!","parent":0,"author":42},"id":1\}
needs to be on one line for openrpc to work
')
} else {
println('
#to test the discover function:
curl -X POST -H "Content-Type: application/json" -d \'\{"jsonrpc":"2.0","method":"rpc.discover","id":1,"params":[]\}\' http://localhost:9933/
\'
')
}
rpc.start(http_port: http_port)!