Technical implementation of no-refreshing chat rooms
Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Let's briefly describe
Use a program to generate the required XML file
Use XMLHTTP or DSO (note status) to regularly refresh required data
It is relatively easy for DSO to map to recordset.
The following is a simple and simple example of what I wrote to play.
Only code snippets, but it is sufficient for technical reference.
MSXML 4.0 is required
On the server side, I wrote two constructors: Chat content chat users.
<Script language = "JScript" runat = "server">
Function SLIGHTBOYChat ()
This. XMLDOMElement = Server. CreateObject ("Msxml2.FreeThreadedDOMDocument. 4.0 ")
This. Add = function (Name, Content, Append)
Var root = this.XMLDOMElement.doc umentElement;
Var newItem = this. XMLDOMElement. createElement ("Item ");
Var newItemName = this. XMLDOMElement. createElement ("Name ");
Var newItemNameValue = this. XMLDOMElement. createCDATASection (Name );
NewItemName. appendChild (newItemNameValue)
Var newItemContent = this. XMLDOMElement. createElement ("Content ");
Var newItemContentValue = this. XMLDOMElement. createCDATASection (Content );
NewItemContent. appendChild (newItemContentValue)
Var newItemAppend = this. XMLDOMElement. createElement ("Append ");
NewItemAppend. text = Append;
NewItem. appendChild (newItemName );
NewItem. appendChild (newItemContent );
NewItem. appendChild (newItemAppend );
If (root. childNodes. length> 10)
Root. removeChild (root. firstChild)
Root. appendChild (newItem)
This. Save = function ()
Application ("ChatContent") = this. XMLDOMElement. xml;
This. GUID = function (PushGUID)
If (PushGUID. Count> 0)
This. ID = PushGUID;
This. ID = "";
This. Xml = function ()
If (this. ID! = "")
Var XMLDOMElementString = "<? Xml version = "1.0" encoding = "gb2312"?> <Chat> ";
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.