private void SendMsg() { MessageInfo message = new MessageInfo() { SendUserId = m_CurrentUser.UserData.OpenId, SendUserName = m_CurrentUser.UserData.UserName, ReciveUserId = m_Context.Request["ReciveUserId"], ReciveUserName = m_Context.Request["ReciveUserName"], Content = m_Context.Request["Content"] }; string result = GetResponseData(message); if (dict.ContainsKey(message.ReciveUserId)) { dict[message.ReciveUserId].Result = result; dict[message.ReciveUserId].Send(); } _IAsyncResult.Result = result; _IAsyncResult.Send(); }
public void BroadCastMsg() { MessageInfo message = new MessageInfo() { SendUserId = m_CurrentUser.UserData.OpenId, SendUserName = m_CurrentUser.UserData.UserName, Content = m_Context.Request["Content"] }; string result = GetResponseData(message); foreach (string key in dict.Keys) { if (!string.Equals(m_CurrentUser.UserData.OpenId, key, StringComparison.OrdinalIgnoreCase)) { ServerPushResult IAsyncResult = dict[key]; IAsyncResult.Result = result; IAsyncResult.Send(); } } _IAsyncResult.Result = result; _IAsyncResult.Send(); }