Websocket broadcasting messages issue

0

Our team have implemented websockets using serverless (lambda) architecture, which works great until scalability comes into picture. Is our understanding correct that currently is there is no way to broadcast messages to all websocket connected clients.

We have to manually store connection Ids, and every time we want to broadcast to all connected clients we need to retrieve all of those first, and then post a message to every single connection ID. If we are talking about broadcasting to more than 1000+ users with multiple websocket connections, surely latency will become an issue. Is there any alternative solution to this problem?

Edited by: KrishnaMK on Jul 23, 2019 1:06 PM

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

There are 2 parts:

  1. Retrieve all connection Ids from where they are stored
  2. Post a message to every single connection id

#1 is totally up to you. Use in-memory cache or other solution which can reduce the latency.

For #2, at this time, your best shot would be using HTTP/2 multiplexing to send requests in parallel.

AWS
已回答 5 年前
0

Thank you very much for your suggestions!

已回答 5 年前

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

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

回答問題指南