Is there any way to establish a connection with Google IoT pub-sub API in flutter?
I tried this library but it doesn't have the configuration which I am looking for.
I have the following data which will be used to establish the connection:
{
"type": ,
"project_id": ,
"private_key_id": ,
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_email": ,
"client_id": ,
"auth_uri": ,
"token_uri": ,
"auth_provider_x509_cert_url": ,
"client_x509_cert_url":
}
Cloud IoT Core supports the MQTT protocol by running a managed broker that listens to the port mqtt.googleapis.com:8883 . Port 8883 is the standard TCP port reserved with IANA for secure MQTT connections.
Google Cloud Pub/Sub provides messaging between applications. Cloud Pub/Sub is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher applications can send messages to a "topic" and other applications can subscribe to that topic to receive the messages.
Push subscriptionThe Pub/Sub server sends each message as an HTTPS request to the subscriber client at a pre-configured endpoint. This request is shown as a PushRequest in the image. The endpoint acknowledges the message by returning an HTTP success status code.
You can use gcloud package in your flutter app. It provides support for Cloud Datastore, Cloud Storage, and Cloud Pub/Sub. Hope it helps.
P.S. Don't use any third-party libraries to connect with Google services. It may not have full support or may stop working at any point of time. Use libraries that are being provided by Google. Other client libraries for Google PubSub are listed here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With