apigateway websocket using posttoconnection in client side

0

hello, I'm trying to use apigateway websocket in chat room. Is it okay to use following usecase?

  1. join room .
  2. get user's connectionids in chat room from lambda.
  3. send messages to users in chat room directly, using posttoconnection in client side.

I know I can do this, but I was curious about security perspective. Is it okay to give users(I'm using cognito identity role) IAM policy of execute-api:manageconnection directly?

已提問 1 年前檢視次數 458 次
2 個答案
0
已接受的答案

Hi,

I would actually avoid using api gateway for websocket purposes as it gets very tricky and manual to set itu p. You need lambda functions, dynamodb to store sessions etc..

I would suggest to take inspiration from serverlessspresso workshop: https://workshop.serverlesscoffee.com/0-introduction/1-overview.html which leverage IOT Core which may be more resilient and better as choice.

Hope it helps ;)

profile picture
專家
已回答 1 年前
0

It does not seem like the right approach. You should send the message to the server and have a Lambda function to send it to the other participant.

profile pictureAWS
專家
Uri
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南