src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Unity/GrpcChannelProvider.cs
/// <summary>
/// Create a channel to the target and register the channel under the management of the provider.
/// </summary>
Create a channel to the target and register the channel under the management of the provider.
Create a channel to the target and register the channel under the management of the provider .
public GrpcChannelx CreateChannel(CreateGrpcChannelContext context)
        {
            var channelOptions = CreateGrpcChannelOptions(context.ChannelOptions);
            var id = Interlocked.Increment(ref _seq);
            var channel = new Channel(context.Target.Host, context.Target.Port, context.Target.ChannelCredentials, channelOptions);
            var channelHolder = new GrpcChannelx(
                id,
                context.Provider.UnregisterChannel ,
                channel,
                new Uri((context.Target.ChannelCredentials == ChannelCredentials.Insecure ? "http" : "https") + $"://{context.Target.Host}:{context.Target.Port}"),
                channelOptions
            );
            lock (_channels)
            {
                _channels.Add(channelHolder);
            }
            return channelHolder;
        }
public GrpcChannelx CreateChannel ( CreateGrpcChannelContext context ) { var channelOptions = CreateGrpcChannelOptions ( context . ChannelOptions ) ; var id = Interlocked . Increment ( ref _seq ) ; var channel = new Channel ( context . Target . Host , context . Target . Port , context . Target . ChannelCredentials , channelOptions ) ; var channelHolder = new GrpcChannelx ( id , context . Provider . UnregisterChannel , channel , new Uri ( ( context . Target . ChannelCredentials == ChannelCredentials . Insecure ? " " : " " ) + $" :// { context . Target . Host } : { context . Target . Port } " ) , channelOptions ) ; lock ( _channels ) { _channels . Add ( channelHolder ) ; } return channelHolder ; }
Create a channel to the target and register the channel under the management of the provider.
Create a channel to the target and register the channel under the management of the provider .
/* Root provider may be wrapped outside this provider class. */
context
CreateGrpcChannelContext