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

asked 5 years ago866 views
2 Answers
0
Accepted Answer

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
answered 5 years ago
0

Thank you very much for your suggestions!

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions