rpc call with named parameters

23 views
Skip to first unread message

0x80

unread,
May 22, 2012, 8:30:12 AM5/22/12
to BitcoinJS
Hi,

I recently started using your jsonrpc module. I am wondering if there
is a way to call methods with named parameters, and also methods
without an id like notifications.

I got these examples from the jsonrpc 2.0 specs:

rpc call with named parameters:

--> {"jsonrpc": "2.0", "method": "subtract", "params": {"subtrahend":
23, "minuend": 42}, "id": 3}
<-- {"jsonrpc": "2.0", "result": 19, "id": 3}

--> {"jsonrpc": "2.0", "method": "subtract", "params": {"minuend": 42,
"subtrahend": 23}, "id": 4}
<-- {"jsonrpc": "2.0", "result": 19, "id": 4}
a Notification:

--> {"jsonrpc": "2.0", "method": "update", "params": [1,2,3,4,5]}
--> {"jsonrpc": "2.0", "method": "foobar"}


In particular I'd like to use the named parameters. I tried passing in
an object instead of an array like this:

client.call('objectStraight', {foo:"bar", evil:666});

But this results in an error:

TypeError: Object #<Object> has no method 'join'
at Server.handleCall (/Users/thijskoerselman/Development/octo/
mediaprocessor/node_modules/jsonrpc2/src/jsonrpc.js:73:56)
at /Users/thijskoerselman/Development/octo/mediaprocessor/
node_modules/jsonrpc2/src/jsonrpc.js:431:10
at IncomingMessage.<anonymous> (/Users/thijskoerselman/Development/
octo/mediaprocessor/node_modules/jsonrpc2/src/jsonrpc.js:439:5)
at IncomingMessage.emit (events.js:64:17)
at HTTPParser.onMessageComplete (http.js:137:23)
at Socket.ondata (http.js:1410:22)
at TCP.onread (net.js:354:27)

Is it possible with the current implementation?

Thijs Koerselman

unread,
May 29, 2012, 8:20:45 AM5/29/12
to BitcoinJS
Is anyone reading this list?

Stefan Thomas

unread,
May 29, 2012, 8:29:49 AM5/29/12
to bitc...@googlegroups.com
Sorry for the late reply! The feature you mentioned doesn't exist in our
jsonrpc package, but we'd be happy to accept a patch.

Thijs Koerselman

unread,
May 29, 2012, 8:59:43 AM5/29/12
to bitc...@googlegroups.com
Ok thanks. I will have to live without it for now then. I don't have
time to get into this.

Cheers,
Thijs
Reply all
Reply to author
Forward
0 new messages