Esempio n. 1
0
        public IRestChannel Get(string name, ChannelOptions options)
        {
            if (!_channels.TryGetValue(name, out var result))
            {
                var channel = new RestChannel(_ablyRest, name, options);
                result = _channels.AddOrUpdate(name, channel, (s, realtimeChannel) =>
                {
                    if (options != null)
                    {
                        if (result != null)
                        {
                            result.Options = options;
                        }
                    }

                    return(realtimeChannel);
                });
            }
            else
            {
                if (options != null)
                {
                    result.Options = options;
                }
            }

            return(result);
        }
Esempio n. 2
0
        public bool Release(string name)
        {
            RestChannel removedChannel = null;

            if (_channels.TryRemove(name, out removedChannel))
            {
                return(true);
            }
            return(false);
        }