简体   繁体   English

AWS 使用 websocket 将数据从 dynamo DB 发送到客户端

[英]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.

相关问题 如何在 AWS-lambda 中使用 nodeJS 对 dynamo DB 中的数据进行排序 - How to sort data from dynamo DB using nodeJS in AWS-lambda 在 AWS ServerLess 中使用来自 dynamo db 的 gsikey 检索员工详细信息 - To retrieve Employee Details by using gsikey from dynamo db in AWS ServerLess 使用AWS在Dynamo DB中搜索 - Searching in Dynamo DB with AWS 如何使用websocket将json中的base64 url​​数据从javascript客户端发送到nodejs服务器? - How to send base64 url data using json from javascript client to nodejs server using websocket? 如何使用 NodeJS 在 AWS Dynamo DB 中进行更新 - How to do update in AWS Dynamo DB using NodeJS 如何使用异步等待使 AWS dynamo db 在 nodejs 中工作 - how to make AWS dynamo db work in nodejs in using async await 从服务器端向客户端节点发送数据 - Send data from server side to client side Node 将 Lambda 与 NodeJS 一起使用并从 Dynamo 数据库正确获取值,我无法处理收到的 json 数据 - Using Lambda with NodeJS and fetching value correctly from Dynamo db, I cannot process the json data recieved Socket.io-无法在Node / Express Web应用程序中使用Socket.io从服务器端向客户端发送数据? - Socket.io - Unable to send data from the Server side to client side using Socket.io in a Node/Express web app? 如何将客户端数据发送到服务器端 - How to send client side data to server side
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM