Architecture and Design¶
- Client to Client: Web app clients can subscribe and publish to the same topics, allowing direct communications between them.
- Cloud to Client: Your cloud code (ex: Lambdas) can easily publish to topics subscribed to by clients.
- Client to Cloud? Generally, existing mechanisms such as API Gateway are better for this. However, it is possible to subscribe Lambdas to topics.
- Cloud to Cloud? Only use Cargoplane this way if the cloud subscriber is in addition to web clients. For pure cloud to cloud, there are better options available within AWS such as SNS.
In order to achieve the subscribe, publish, and receive capabilities there are two modules:
- cloud: Lambda to give the correct credentials.
- client: Browser client to send and receive messages.
Here are the steps:
- Call AWS Lambda to get AWS IoT credentials and endpoint
- Make MQTT Connection to AWS IoT with credentials
From there, you can:
- Subscribe to topics and receive messages
- Publish messages to topics