Replies: 1 comment 1 reply
-
Interesting question! The reason I decided to use the SQS is 2-fold, first it makes the onConnect handler quicker to respond to the connecting user (broadcasting might take a while!), but also - the user status update is not a critical path of the application, hence it can be made asynchronous using the queue. Noone minds if they get the notification with a bit of a lag, but sending messages should be as instant as possible. With that said, that only scales to a certain limit. For broadcasting to a large amount of users, you should still consider using an SQS queue, or use AppSync instead of this solution. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I noticed in
onconnect
lambda, when a user connects, we use SQS to trigger a lambda that broadcasts to all other users that this user has come online.In the
onmessage
lambda, we don't use SQS, but broadcast directly.Do we really need SQS in the
onconnect
handler? Can't we just broadcast from theonconnect
lambda directly? Is there a trade-off here?Beta Was this translation helpful? Give feedback.
All reactions