melihercan / WebRTCme

A cross-platform framework for adding WebRTC support to .NET MAUI, Blazor, and Desktop applications by using a single unified .NET/C# API.
https://github.com/melihercan/WebRTCme
MIT License
226 stars 46 forks source link

SUGGESTION: Allow runtime definition of signaling server #9

Open georgeinva2004 opened 2 years ago

georgeinva2004 commented 2 years ago

Again, your work on this is BRILLIANT!!!! I do have one suggestion. There may be cases where the signaling server needs to be set at runtime vs a static config file. While the MemoryConfigurationSource seems to be an option on Xamarin, it doesn't seem to work with the Blazor implementation. Perhaps creating a service that provides a runtime URL and injecting it into the SignalingStub constructor. Maybe something like this:

`namespace WebRTCme.Connection.Signaling.Proxy.Interfaces { public interface ISignalingUrlProvider { string GetSignalingServerUrl(); }

}`

` Interfaces.ISignalingUrlProvider signalingUrlProvider; public SignalingStub(IConfiguration configuration, Interfaces.ISignalingUrlProvider sigProvider) { _signallingServerBaseUrl = configuration["SignallingServer:BaseUrl"];

        signalingUrlProvider = sigProvider;

        if (signalingUrlProvider != null)
        {
            _signallingServerBaseUrl = signalingUrlProvider.GetSignalingServerUrl();
        }

// Rest of your constructor`

Then adding an implementation of ISignalingUrlProvider and injecting it at startup.

builder.Services.AddSingleton<WebRTCme.Connection.Signaling.Proxy.Interfaces.ISignalingUrlProvider, Services.SignalingServerUrlProvider>();

melihercan commented 2 years ago

Hi there and thanks for your kind words. Currently I am in the middle of something and pretty busy. I will check both items at the weekend. Thanks

georgeinva2004 commented 2 years ago

No problem!!! Thank-you!

melihercan commented 2 years ago

Sorry I couldn't create any time this weekend. Simple too busy. I will check these in the coming days when I have some free time.