コード例 #1
0
        /// <summary>Publish several messages on this channel.</summary>
        public async Task <Result> PublishAsync(IEnumerable <Message> messages)
        {
            var tw = new TaskWrapper();

            try
            {
                PublishImpl(messages, tw.Callback);
            }
            catch (Exception ex)
            {
                tw.SetException(ex);
            }
            var result = await Task.WhenAny(Task.Delay(RealtimeClient.Options.RealtimeRequestTimeout), tw.Task);

            if (result == tw.Task)
            {
                return(tw.Task.Result);
            }
            return(Result.Fail(new ErrorInfo("PublishAsync timeout expired. Message was not confirmed by the server")));
        }