public override async Task OnConnectedAsync() { //manage and track connections here if (!SignalRKafkaProxy.AllConsumers.Keys.Contains(Context.ConnectionId)) { Console.WriteLine("Recieved new connection"); // SignalRClient client = extractInformation(Context); SignalRKafkaProxy.AddClient(client); //Create a connection object Consumer <string, string> consumerObj = new Consumer <string, string>(client.ConsumerConfig); consumerObj.Subscribe(client.Topic); Console.WriteLine($"Adding {consumerObj}"); SignalRKafkaProxy.AddConsumer(client.ConnectionId, consumerObj); } await base.OnConnectedAsync(); }
public override async Task OnConnectedAsync() { //1. Every incoming connection comes with "ConsumerGroupId" and "Topic" //2. Create a consumer object for each new connection and cache it in some place(may be in-memory dictionary for now). //3. Background services can continually poll these connections and inform connected clients about the new messages. if (!SignalRKafkaProxy.AllConsumers.Keys.Contains(Context.ConnectionId)) { Console.WriteLine("Recieved new connection"); SignalRClient client = extractInformation(Context); SignalRKafkaProxy.AddClient(client); //Create a connection object Consumer <string, string> consumerObj = new Consumer <string, string>(client.ConsumerConfig); consumerObj.Subscribe(client.Topic); Console.WriteLine($"Adding {consumerObj}"); SignalRKafkaProxy.AddConsumer(client.ConnectionId, consumerObj); } await base.OnConnectedAsync(); }