Here are some examples of how you can publish messages to the Google Cloud MQTT system.
Important note: Google uses their own way of subscribing to their MQTT server. Gravio does not support subscribing to the Google specification of MQTT yet. Gravio focuses on publishing to the Google Core IoT system.
Go to the Google Cloud console and create a project:
Moving to the IoT core on Google Cloud Platform
Enable the Google IoT Core API.
Create a device registry
Enter the name of your registry, select a region and add a topic (in this case events
and states
etc).
On this screen, click on ‘Add device’.
And it will look like this:
Type the following command on the command line to create a certificate that can be pasted into the field
openssl req -x509 -newkey rsa:2048 -keyout rsa_private.pem -nodes -out rsa_cert.pem -subj "/CN=unused"
This will create a file called rsa_private.pem
and a file called rsa_cert.pem
.
Copy the contents of the rsa_cert.pem
file to the window.
Note the Topic ID is: "/devices/" + deviceID + "/" + topic name
And the Client ID is: "projects/" + projectID + "/locations/" + regionID + "/registries/" + registriesID + "/devices/" + deviceID
You are now ready to receive messages from Gravio.
Need more help with this?
Join our slack community for help