Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

Difficulty with RPC calls from command line

Hi All,

I can't get RPC calls to work with the simple sequence that is shown on the RPC mechanism page. Here are three examples:

C:\Mong\Optimize5>mos --port ws://192.168.4.1/rpc call XSquirt
1

C:\Mong\Optimize5>mos --port ws://192.168.4.1/rpc call XscanZone '{"a":1}'
Error: Args ['{a:1}'] is not a valid JSON string

C:\Mong\Optimize5>mos --port ws://192.168.4.1/rpc call Sum '{"a":50,"b":50}'
Error: Args ['{a:50,b:50}'] is not a valid JSON string

The first RPC has no arguments and completes successfully. The second and third RPCs have one and 2 arguments respectively, delivering the indicated errors. All three work successfully with XHR Posts.

Also....

C:\Mong\Optimize5>mos call RPC.list
Using port COM3
Error: remote error 404: No handler for RPC.list

Thanks for your help,

SW

Comments

  • mtraxmtrax Canberra

    Parsing of json strings works differently on Windows, I think there reference to this on docs pages

    Thanked by 1jstevewood
  • jstevewoodjstevewood California

    Thanks for the direction. If I change the RPC call to:

    C:\Mong\Optimize5>mos --port ws://192.168.4.1/rpc call XscanZone "{"""a""":1}"

    it works perfectly. ( i. e. Single quotes don't work, and embedded double quotes must be enclosed in quotes themselves. only Microsoft ).

    I am still struggling with mos call RPC.list. any ideas?

  • nliviunliviu Romania

    It is RPC.List

    Thanked by 1jstevewood
  • jstevewoodjstevewood California

    Thanks, sometimes I think I must be lysdexic

Sign In or Register to comment.