[英]AWS using websocket to send data from dynamo DB to client side
Hi i am new to AWS and IOT in general , is there a way to let AWS console send data stored in Dynamo DB on update to client side using web-socket ?嗨,我是 AWS 和 IOT 的新手,有没有办法让 AWS 控制台使用 web-socket 将更新时存储在 Dynamo DB 中的数据发送到客户端?
ESP32-->DynamoDB ----OnUpdate()--->send json to client using web-socket ESP32-->DynamoDB ----OnUpdate()--->使用 web-socket 向客户端发送 json
You'll likely need to use a combination of AWS products to do this, but yes, it's possible.您可能需要使用 AWS 产品的组合来执行此操作,但是是的,这是可能的。 Here's how you might set it up to work in a pretty serverless way, that scales to whatever traffic you want at a linear cost per operation:
以下是您可以如何设置它以非常无服务器的方式工作,以每次操作的线性成本扩展到您想要的任何流量:
ESP32 -> DynamoDB - You're doing a PutItem or UpdateItem operation here, note that and make sure there's a way to filter the operations you want to send updates for. ESP32 -> DynamoDB - 您正在此处执行 PutItem 或 UpdateItem 操作,请注意并确保有一种方法可以过滤要为其发送更新的操作。
Activate DynamoDB Streams - this is a system that will do something you want for each change in the DynamoDB table.激活DynamoDB Streams - 这是一个系统,它会针对 DynamoDB 表中的每个更改执行您想要的操作。 You'll have the option of choosing which data to include in the stream events, depending on what you need access to, you can make a choice.
您可以选择将哪些数据包含在流事件中,具体取决于您需要访问的内容,您可以做出选择。
Set up a Lambda function in whatever language you want and configure it to be called in response to the stream .以您想要的任何语言设置一个Lambda函数,并将其配置为响应流而调用。 This gives you a fast and consistent way to process each event on the stream.
这为您提供了一种快速且一致的方式来处理流中的每个事件。 Write your logic in the Lambda to check whether this update needs to be broadcast or not, and which topic it should be sent under.
在 Lambda 中编写您的逻辑以检查此更新是否需要广播,以及它应该在哪个主题下发送。
Set up IoT Core for access from the browser, probably using MQTT over Websockets, and send the message into the topic you want from the Lambda.设置IoT Core以从浏览器访问,可能使用 MQTT over Websockets,并将消息从 Lambda 发送到您想要的主题。
This should do what you want.这应该做你想做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.