How to broadcast the websocket messages to all replicas of the azure container apps

Roshan Shah 0 Reputation points
2024-07-15T15:05:32.3866667+00:00

I have both frontend and backend on an internal vnet azure container apps environment.

Its a nodejs and angular system and its using socket.io and nginx.

I wish to send the websocket message to all instances of the backend vice versa

Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
444 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 66,706 Reputation points
    2024-07-15T15:55:19.3266667+00:00

    the easiest is to use signal/r and setup a hub, all the servers are listening to.

    if you want to code yourself, you will need to write a discovery service, that can be used for the server to discover each other. the servers should ping the discovery service, so keep it informed of the server health. you can use a database (or redis) to track the ipaddress of all live servers. this list can be used to broadcast to all live servers.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.