UCWA (Lync 웹 응용 프로그램)를 사용하여 양방향 채팅을 구현하려고하는데 데이터를 클라이언트에 보낼 수는 있지만 클라이언트에서 다시 수신하려면 어떻게해야합니까? 적절한 양방향 채팅을 구현할 수 있습니까?UCWA를 사용하여 채팅
특정 사용자에게 일부 ping을 전송하는 코드가 첨부되어 있습니다. 사용자가 채팅을 구현하기 위해 데이터를 다시받는 방법은 무엇입니까?
private void StarConversation(string startConversationLink, string hostName, string accessToken, string tokenType)
{
var myObject = new JObject();
myObject.Add("operationId", Guid.NewGuid().ToString().Replace("-", ""));
myObject.Add("to", "sip:[email protected]");
myObject.Add("subject", "TestConv");
List<string> outgoing = new List<string>();
List<string> incoming = new List<string>();
List<string> timeout = new List<string>();
JObject href = new JObject();
string sending = "Hey there ! how are you doing ?";
href.Add("href", "data:text/plain;base64," + Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(sending)));
JObject message = new JObject();
message.Add("message", href);
myObject.Add("_links", message);
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", tokenType + " " + accessToken);
client.PostAsync(new Uri(hostName + startConversationLink), new StringContent(JsonConvert.SerializeObject(myObject), Encoding.UTF8, "application/json")).Result;
if (response.IsSuccessStatusCode)
{
Uri temp = new Uri(hostName + m_eventsLink);
HttpResponseMessage response2 = Get(client, temp.ToString());
string nextLink = string.Empty;
string timeo ;
string ss = string.Empty;
int i =0;
if (response2.IsSuccessStatusCode)
{
string retData2 = response2.Content.ReadAsStringAsync().Result;
var o = JObject.Parse(retData2);
nextLink = o["_links"]["next"]["href"].Value<string>();
response = client.PostAsync(new Uri(hostName + startConversationLink), new StringContent(JsonConvert.SerializeObject(myObject), Encoding.UTF8, "application/json")).Result;
temp = new Uri(hostName + m_eventsLink);
response2 = Get(client, temp.ToString());
retData2 = response2.Content.ReadAsStringAsync().Result;
o = JObject.Parse(retData2);
}
}
}