Search code examples
javascriptasynchronousskypeskype-for-business

Message appears twice using Skype SDK chat


i used skype sdk Here and here is my code snippet after

config.conversation.historyService.activityItems.added(function(newMsg) {
  if(typeof newMsg.direction != 'function') {} else {
    if(newMsg.direction() == 'Incoming') {
      direction = "black";
    } else if(newMsg.direction() == 'Outgoing' && newMsg.status() === "Succeeded") {
      direction = "green";
    } else {}
    $("#conversationText").append('<br/><div class="chat-user-info"><h1 class="chat-user-name">' + newMsg.sender.displayName() + '</h1><h2 class="chat-user-time">' + new Date() + '</h2></div><div class="chat-user-message"><h3 style="color:' + direction + ';">' + newMsg.text() + '</h3></div><br/>');
  }
});

But, the message appears when it is on state pending or even if fails , after this i try to put the message inside but it appears only on the other side not mine.

Github related issue Here


Solution

  • I did solve this by workaround appending the message first regardless message.direction() value