AWS HTTP API to WebSocket API Bridge / Async Lambda

。_饼干妹妹 提交于 2020-06-12 08:02:43

问题


I'd really appreciate any advice on the following. Building a real-time infrastructure for android mobile devices to connect to windows POS systems.

  1. POS system will run a .NET app that will connect to AWS WebSocket API Gateway and register with a storeId.

  2. Android device will call an AWS HTTP API Gateway endpoint to retrieve POS information from the store.

Here's the part I'm not sure about. I'd like the AWS HTTP endpoint to trigger a lambda function that will lookup the websocket connectionId from the storeId and send a message to the connected store and wait for a new message from the store. The store client would receive the websocket message, collect the info, then send it to dynamodb and then notify the original lambda function that the data is ready to send back.

Can lambda do that? Connect to another websocket api, wait for a message, then disconnect, and eventually return the original HTTP API request to the android client? Am I going down the wrong path?

Is there a better way for an AWS HTTP API endpoint to send a message to a websocket client and get a response?

My other approach was to have the android client connect via websocket as well. Send request messages back and forth via websocket, and then call http api to upload / download larger data payloads. But would still like to find some way to provide HTTP API to others in order to retrieve the store data via the websocket client.

来源:https://stackoverflow.com/questions/54936658/aws-http-api-to-websocket-api-bridge-async-lambda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!