Example #1
0
        public void CreateClient(string chatToken)
        {
            this.chatClient           = null;
            TwilioChatClient.LogLevel = LogLevel.Info;
            var properties = new TwilioChatClientProperties();

            properties.CommandTimeout = (ulong)CommandTimeout.Min;
            TwilioChatClient.ChatClientWithToken(
                chatToken, properties, this, (result, chatClient) =>
            {
                if (result.IsSuccessful)
                {
                    Logger.Info("TwilioChatHelper", "Client created");
                    this.RegisterForNotificationsFromTwilioChatService(chatClient);
                    this.chatClient = chatClient;
                    chatClient.ChannelsList
                    .PublicChannelDescriptorsWithCompletion(HandleChannelDescriptorPaginatorCompletion);

                    CreateChannel(System.Guid.NewGuid().ToString());
                }
                else
                {
                    Logger.Error("TwilioChatHelper", $"Can't create client: {result.Error.Description}");
                }
            });
        }
Example #2
0
 public void CreateClient(string chatToken)
 {
     this.twilioChatClient     = null;
     TwilioChatClient.LogLevel = LogLevel.Info;
     TwilioChatClient.ChatClientWithToken(
         chatToken, new TwilioChatClientProperties(), this, (result, chatClient) =>
     {
         if (result.IsSuccessful)
         {
             Logger.Info("TwilioChatHelper", "Client created");
             this.RegisterForNotificationsFromTwilioChatService(chatClient);
             this.twilioChatClient = chatClient;
             chatClient.ChannelsList
             .PublicChannelDescriptorsWithCompletion(HandleChannelDescriptorPaginatorCompletion);
         }
         else
         {
             Logger.Error("TwilioChatHelper", $"Can't create client: {result.Error.Description}");
         }
     });
 }