Top

GetMessagesFromConversation return zero messages in message list on Rainbow.CSharp.SDK nuget package

Beantwortet

Kommentare

9 Kommentare

  • Christophe IRLES

    Hi,

    In the code snippet provided, there is a mistake after this:

    imMsglist.GetMessagesFromConversation(convObj, 3, callback3 =>

    {

    if (callback3.Result.Success) {  // Here you use callbakc2 instead

    ...

    }

    }

    );

    Hope this helps,
    Regards.
    Christophe

    0
    Aktionen für Kommentare Permalink
  • Sathya MANOHARAN

    Hi Christophe,

      Yes, I was put previous one response i will change this. but every time I check with the response  return by the imMsglist.GetMessagesFromConversation i.e, callback3, I did't get any message list.

    0
    Aktionen für Kommentare Permalink
  • Christophe IRLES

    Have you tried this example:

    https://github.com/Rainbow-CPaaS/Rainbow-CSharp-SDK-Samples/tree/master/InstantMessaging

    Using this sample with your accounts do you have still the pb ?

     

    0
    Aktionen für Kommentare Permalink
  • Christophe IRLES

    Hi Sathya,

    Do you have still your problem ?
    Do you reproduce it with the sample coming from the SDK ?

    Thanks,
    Regards.
    Christophe

    0
    Aktionen für Kommentare Permalink
  • Sathya MANOHARAN

    Hi Christophe,

    Yes, I have this problem. When I debug this code, the debugger never came inside GetMessagesFromConversation code even in else portion as well.

    imMsglist.GetMessagesFromConversation(convObj, 3, callback3 =>{

    if (callback2.Result.Success)
    {
    }
    else
    {

    }

    0
    Aktionen für Kommentare Permalink
  • Christophe IRLES

    Hi,

    Again in your code snippet there is an error ... (callback2 used instead of callback3 ...)

    Do you check the pb with the sample provide in the SDK ?

    Could you share your code ? So I could try to reproduce the pb.

    Thx

    0
    Aktionen für Kommentare Permalink
  • Sathya MANOHARAN

    Hi Cristophe,

      I copied that lines from previous post.

      Here below I put my sample code,

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    Rainbow.Application myApp = new Rainbow.Application();
    myApp.SetApplicationInfo(ConfigurationManager.AppSettings["AppId"].ToString(), ConfigurationManager.AppSettings["AppSecretKey"].ToString());
    myApp.SetHostInfo(ConfigurationManager.AppSettings["Hostname"].ToString());

    myApp.Login("username", "password", callback =>
    {
    if (callback.Result.Success)
    {
    Rainbow.Contacts contacts = myApp.GetContacts();
    String contactID = "xxxxxx"; // Your contact id
    contacts.GetContactFromContactIdFromServer(contactID, callback1 =>
    {
    if (callback1.Result.Success)
    {
    Contact contact = callback1.Data; // Contact found
    Rainbow.Conversations conversations = myApp.GetConversations();
    conversations.GetConversationFromContactId(contactID, callback2 =>
    {
    if (callback2.Result.Success)
    {
    Conversation convObj = callback2.Data; // List of conversations
    Rainbow.InstantMessaging imMsglist = myApp.GetInstantMessaging();
    imMsglist.GetMessagesFromContactId(contactID, 3, callback3 =>
    {
    if (callback3.Result.Success)
    {
    }
    else
    {

    }
    });
    }
    else
    {
    if (callback2.Result.Type == SdkError.SdkErrorType.IncorrectUse)
    {
    // Bad parameters used
    string errMsg = callback2.Result.IncorrectUseError.ErrorMsg;
    }
    else
    {
    // Exception occurs
    Exception e = callback2.Result.ExceptionError;
    }
    }
    });
    }
    else
    {
    if (callback1.Result.Type == SdkError.SdkErrorType.IncorrectUse)
    {
    // Bad parameters used
    string errMsg = callback1.Result.IncorrectUseError.ErrorMsg;
    }
    else
    {
    // Exception occurs
    Exception e = callback1.Result.ExceptionError;
    }
    }
    });
    }
    else
    {
    // A pb occurs
    if (callback.Result.Type == SdkError.SdkErrorType.IncorrectUse)
    {
    // Bad parameter(s) used
    string errMsg = callback.Result.IncorrectUseError.ErrorMsg;
    }
    else
    {
    // Exception occurs
    Exception e = callback.Result.ExceptionError;
    }
    }
    });

    0
    Aktionen für Kommentare Permalink
  • Christophe IRLES

    Hi Sathya,

    1) When you login you need to wait the event "ConnectionStateChanged" with a value equal to ConnectionState.Connected before to continue any action

    Cf. https://hub.openrainbow.com/#/documentation/doc/sdk/csharp/api/Rainbow#Rainbow.Application.ConnectionStateChanged

    2) You can get messages only wih a contact in your roster. So after

    Rainbow.Contacts contacts = myApp.GetContacts();

    // One you connection state is Connected
    contacts.GetAllContacts(...)
    String contactID = "xxxxxx"; // Your contact id
    contacts.GetContactFromContactId(contactID) => Must return a non null Contact object


    3) As suggested could you first use the SDK Sample with your accountID to check if you retrieve well your messages.
    https://github.com/Rainbow-CPaaS/Rainbow-CSharp-SDK-Samples/tree/master/InstantMessaging

    Regards,
    Christophe

    0
    Aktionen für Kommentare Permalink
  • Sathya MANOHARAN

    Hi Christophe,

      Ok, I will check. Thanks for your support.

    0
    Aktionen für Kommentare Permalink

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Sie können immer noch nicht finden, was Sie brauchen?

  • Kontaktieren Sie uns

    Haben Sie eine Frage zu Rainbow? Hinterlassen Sie uns eine Nachricht, um weitere Informationen zu erhalten.

    Kontakt
  • Fragen Sie die Gemeinschaft

    Brauchen Sie Hilfe? Stellen Sie Ihre Fragen in der Community, um Antworten von anderen Rainbow-Benutzern zu erhalten.

    Nachricht posten