I am trying to build a real-time chat app using AWS Lambda + Websocket API in API Gateway.
What I want to do is save the connectionId of each user in my DB to be able to send messages to specific clients when 2 users are in the same conversation for example.
How can I specify the connectionIds target from the lambda function in python?
This should actually be a list of connectionId to send to every people i am speaking with inside the app's current conversation.
The pseudo-code would look like (inside the lambda) :
def create_message(message, conversation):
save_message_in_db(message)
ids_that_should_receive_message = conversation["participantsID"]
return {"body": json.dumps({"message": message}), "connectionId": ids_that_should_receive_message}
Thanks in advance
