snap rpc

snap rpc call unicast

Description

Callback Unicast RPC

Usage

snap [global options] rpc call (u | unicast) <target> <func> [<args>...] [-h] [-c <callback-name>]

Positional Arguments

target
SNAP address of target node or bridge
func
Name of function to call on targets
args
A list of arguments to pass to the function (space-delimited, use quotes to pass an argument with whitespace.)

Options

-c <name>, --callback-name <name>
 Specify which function will be called on a response from the targets

Examples

Ask the bridge node getInfo(5):

snap rpc call u bridge getInfo 5

Ask the bridge node vmStat(6), expect it to return its result via tellVmStat:

snap rpc call u bridge vmStat 6 --callback-name tellVmStat

snap rpc call multicast

Description

Callback Multicast RPC

Usage

snap [global options] rpc call (m | multicast) <targets> <func> [<args>...] [-h] [-g <group>] [-t <ttl>] [-c <callback-name>]

Positional Arguments

targets
A comma separated list of SNAP addresses
func
Name of function to call on targets
args
A list of arguments to pass to the function (space-delimited, use quotes to pass an argument with whitespace.)

Options

-g <group>, --group <group>
 Override the Network’s default multicast group
-t <ttl>, --ttl <ttl>
 Override the Network’s default multicast TTL
-c <name>, --callback-name <name>
 Specify which function will be called on a response from the targets

Examples

Broadcast a request for getInfo(5), expect responses from 123456 and 789abc:

snap rpc call m 123456,789abc getInfo 5

snap rpc call directed-multicast

Description

Callback Directed Multicast RPC

Usage

snap [global options] rpc call (d | dm | directed-multicast) <targets> <func> [<args>...] [-h] [-g <group>] [-t <ttl>] [-d <delay>] [-c <callback-name>]

Positional Arguments

targets
A comma separated list of SNAP addresses
func
Name of function to call on targets
args
A list of arguments to pass to the function (space-delimited, use quotes to pass an argument with whitespace.)

Options

-g <group>, --group <group>
 Override the Network’s default multicast group
-t <ttl>, --ttl <ttl>
 Override the Network’s default multicast TTL
-d <delay>, --delay <delay>
 Specify a response delay in milliseconds from the targets, default is 0
-c <name>, --callback-name <name>
 Specify which function will be called on a response from the targets

Examples

Directed Multicast a request for getInfo(5) to 123456 and 789abc, ask them to delay their responses into 100ms windows:

snap rpc call dm 123456,789abc getInfo 5 --delay 100

snap rpc send unicast

Description

Send Unicast RPC

Usage

snap [global options] rpc send (u | unicast) <target> <func> [<args>...] [-h]

Positional Arguments

target
SNAP address of target node or bridge
func
Name of function to call on targets
args
A list of arguments to pass to the function (space-delimited, use quotes to pass an argument with whitespace.)

Examples

Send ping() to the bridge node:

snap rpc send u bridge ping

snap rpc send multicast

Description

Send Multicast RPC

Usage

snap [global options] rpc send (m | multicast) <func> [<args>...] [-h] [-g <group>] [-t <ttl>]

Positional Arguments

func
Name of function to call on targets
args
A list of arguments to pass to the function (space-delimited, use quotes to pass an argument with whitespace.)

Options

-g <group>, --group <group>
 Override the Network’s default multicast group
-t <ttl>, --ttl <ttl>
 Override the Network’s default multicast TTL

Examples

Broadcast hunt():

snap rpc send m hunt

snap rpc send directed-multicast

Description

Send Directed Multicast RPC

Usage

snap [global options] rpc send (d | dm | directed-multicast) <targets> <func> [<args>...] [-h] [-g <group>] [-t <ttl>] [-d <delay>]

Positional Arguments

targets
A comma separated list of SNAP addresses
func
Name of function to call on targets
args
A list of arguments to pass to the function (space-delimited, use quotes to pass an argument with whitespace.)

Options

-g <group>, --group <group>
 Override the Network’s default multicast group
-t <ttl>, --ttl <ttl>
 Override the Network’s default multicast TTL
-d <delay>, --delay <delay>
 Specify a response delay in milliseconds from the targets, default is 0

Examples

Send nodes 001122, 334455, and 667788 the RPC getData(17, 'blue', 22):

snap rpc send dm 001122,334455,667788 getData 17 'blue' 22