how to lazy instantiate the connection to the Azure SignalR service using a middleware or similar?

BAR Eran 0 Reputation points
2023-03-06T11:21:07.27+00:00

according to the AzureSignalR service docs the way to configure is to do something like below:
the thing is that i need to connect to external service to retrieve the connection string and do additional logic before connecting to Azure SignalR service.
i do not want to connect on my service startup but do some kind of lazy instantiation in a middleware or similar, i will appreciate any assistance here.

            services.AddSignalR(hubOptions =>
            {
                hubOptions.AddFilter<ConsumerHubFilter>();
            }).AddAzureSignalR(options =>
            {
                options.ConnectionString = "";
            });
Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
142 questions
{count} votes

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.