I want to setup a websocket communication between two servers - Server A & Server B. Server A will receive messages from user application, Server A will process the message and route the message to Server B. Server B will process the message and return the response back to A. A will return the response to user application.
I want to reduce the communication time between Server A & B so I decided to use Websockets for this usecase. But the issue with this is that server A is a lambda so the connection will be destroyed when lambda goes back to idle state.
Is there anyway we can cache the connection data from lambda somewhere and re-use it once we receive the request again?
I know this is may be a little weird question but any suggestions or help will be appreciated :)
A breif on why we are stuck with Lambda and where we can cache connection data:
I am building a chat application with Amazon Lex. Lex provides support for integration with Lambda. We can use the lex session storage to store any attributes we want. For each customer input lex calls lambda(server A) and lambda will call another server B.