问题
I'd really appreciate any advice on the following. Building a real-time infrastructure for android mobile devices to connect to windows POS systems.
POS system will run a .NET app that will connect to AWS WebSocket API Gateway and register with a storeId.
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