HTML5 Based Ajax and SSE Technology with Server Intelligent Instant Messaging to Meet the Needs of Transactional Websites

With the continuous development of science and technology, Internet technology has been quietly affect the mode of transmission, traditional web site information data only through the web page to load when it is open, need to update the web page information can only be accomplished by way of a page refresh. In today's efficient informatization environment, has highlighted its problems, restricted information updated timely. In this paper, the new Internet programming language of HTML5 is combined with Ajax and SSE technology to study intelligent instant messaging and realize the new application mode.

Nowadays, the Internet technology covers a wide range of applications, and the advantage of Html5 technology is used to create new application models and bring better experience to users, which is the focus of current research. As a designer, we should consider from the perspective of user demand, pay attention to user experience and meet personalized needs. For example, the stock information website, visitors can get the latest stock market information by refreshing the page, and cannot update the data timely and efficiently. For example, all kinds of e-commerce promotional activities, because the page reload time after the missed a transaction. This waste of time and server resources cannot be ignored, so the immediacy of web page data transmission is becoming increasingly important.
HTML5 is a set of technologies including HTML, CSS and JavaScript that enhance the performance of Web pages and add the functions of Web applications such as local databases. Ajax is called "Asynchronous Javascript And XML" (Asynchronous Javascript And XML). It refers to a web development technology that creates interactive web applications. By exchanging small amounts of data with the server in the background, Ajax can make web pages achieve Asynchronous update. Server-sent Event, or SSE for short, is a component of the HTML 5 specification that can be used to push data from the Server to the browser in real time. By combining the above technologies, intelligent instant messaging can be realized to meet users' demand of real-time information acquisition.

Interactive page design
First, design a simple page for interactive demonstration. <form action="http://127.0.0.1/test.php?action=ajax" method="post" id="action"> <span>username</span><input type="text" name="usr_id" value="" id="txt1"> <span>password</span><input type="text" name="usr_psw" value="" id="txt2"> <input type="submit" name="usr_btn" value="submit" id="sub1"> <pre id="pre_sse"></pre> <pre id="pre_ajax"></pre> </form> Given the space limitations, the basic tags of the web page are omitted and only the tags set for the implementation function are retained. The <form> tag is used to realize the manual interaction between the web page and the server, and two <pre> tags are reserved to display the data obtained through ajax and SSE. Here, the action address of the <form> tag fills in the server program that is ready to handle the ajax information. break;} ?> The code above implements the classification of ajax and sse requests through action values of get. The "ajax request" data is returned when the ajax request is obtained from the web page, and a "data:now is server current time" data is returned every 1000ms when the sse request is obtained.

Design of data transmission and processing module
In order to realize the sending and processing of ajax and sse data, a test.js was written to be introduced into the web page. Meanwhile, jquery library was introduced into the web page. {$sat='ajax Successful data exchange';}else{$sat='ajax Data exchange failed';} $("#pre_ajax").html($("#pre_ajax").html()+"</br>"+$sa t); }); }); }); Then the basic module of the required function is completed. When you open the prepared web page with the browser, you can see the login interface as shown in Figure  1: Ajax successful data exchange Ajax successful data exchange Ajax successful data exchange Ajax successful data exchange Ajax successful data exchange This enables real-time interaction with the server through Ajax and SSE as well as manual interaction with the data.At this point, visitors can update the required information in real time without refreshing the page.

Optimal Design
If complete above operation only, its intelligence is reduced greatly. The Php file can be modified as follows for special cases where the data required by the user does not change and there is no need to re-send the useless data to replace the original data. Through the above code is managed to user data needed for temporary storage by the session on the server, every time when the trigger SSE request, the server will authenticate users need $time data is the data with the last changed, when there is no change, then you won't send change data to the client to repeat, to avoid the client due to rewrite data additional CPU and memory usage, and both the optimization of resource usage is especially important in mobile terminal. Since the $time data set is generated by the current time, this determines that it is always updated per second, so this feature is not represented. In practice, it can be replaced by other required data.
Users continues to increase, although is enabled on the server session variable, but still can cause the server memory footprint is cumulative, and the default session variables automatically destroyed time for 24 min, in the case of 1 s a SSE request frequency, obviously too long, so want to rewrite the survival time of the session variable, and the memory used by the session released when.

Concludes
Through Ajax technology and SSE, instant messaging of the server is realized, which reduces the burden of the server. SEE can be used to push data from the server side to the browser side in real time, which is easier to operate and has less server side changes. Ajax can shift the work of the previous server burden to the client, use the idle capacity of the client to process, reduce the burden of the server and bandwidth, and minimize the burden of redundant requests and responses on the server, thus realizing the new application mode of intelligent instant messaging.