Skip to main content

Samples

We will try to fill this page with good samples for cli usage moving forward.

Start and stop cloud broker

Simple script that starts a broker, extracts its url and api-key and then lists available signals on it and finally shuts it down.

Replace my-organisation and my-project with your own.

start-and-stop-cloud-broker.sh
#!/usr/bin/env bash

set -e

export REMOTIVE_CLOUD_ORGANISATION=my-organisation
export REMOTIVE_CLOUD_PROJECT=my-project

export BROKER_NAME=my-broker

# If you already logged on you can omit this
remotive cloud auth login

remotive cloud brokers create "$BROKER_NAME"

#
# Use jq can be used to extract fields from the result
#
broker_details=$(remotive cloud brokers describe $BROKER_NAME)
broker_name="$(echo "$broker_details" | jq --raw-output .name)"
broker_url="$(echo "$broker_details" | jq --raw-output .url)"
echo "$broker_url"
for key in $(echo "${broker_details}" | jq -r '.keys[]'); do
echo "Broker $broker_name has API-KEY: $key"
done
the_key=$(echo "$broker_details" | jq -r '.keys[0]')
echo "$the_key"

# List available signals
remotive broker signals signal-names --url "$broker_url" --api-key "$the_key" | jq .

# Stop broker
#echo "Stopping broker $broker_name"
remotive cloud brokers delete "$broker_name"

remotive broker discover

When a broker device, like RemotiveBox, is connected to your network with a LAN cable, the device is assigned a random IP address.

The command enables easy discovery of broker devices connected on your network.

➜  ~ remotive broker discover

Looking for RemotiveBrokers on your network, press Ctrl-C to exit...

[ RemotiveBroker GRPC on remotive-broker-office-1._remotivebroker._tcp.local. ]
RemotiveBrokerApp: http://192.168.200.220:8080
RemotiveBroker http://192.168.200.220:50051

Above you see a box named remotive-broker-office-1.

Open http://192.168.200.220:8080 in your browser to access the app or use http://192.168.200.220:50051 to connect to the broker directly.

If your broker doesn't appear on the list, ensure that it is connected to your network with a LAN cable and that your computer is also connected to the same network (either wirelessly or with a LAN cable).