In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
EventSource push (ajax normal polling)
Subscribe to if (window.EventSource) {var eventSource = new EventSource (""); eventSource.onmessage = function (e) {document.body [XSS _ clean] + = e.data +'
';}; / / whenever you connect to the server, the open event eventSource.addEventListener ("open", function () {console.log ("establishing a connection with the server"); / / processes the load event eventSource.addEventListener in the server response message ("load", function (e) {console.log ("data sent by the server to the client is" + e.data);}) / / if no event is specified in the server response message, the message event eventSource.addEventListener ("message", function (e) {console.log ("data sent by the server to the client is" + e.data);}) is triggered by default; / / if an error occurs, the error event eventSource.addEventListener ("error", function (e) {console.log ("data sent by the server to the client is" + e.data);}) is triggered) } else {console.log ("the server does not support EvenSource objects");} eventSource.addEventListener ("open", function () {console.log ("establish a connection with the server");}) / / process the load event eventSource.addEventListener in the server response message ("load", function (e) {console.log ("server load data is:" + e.data);}) / / if no event is specified in the server response message, the message event eventSource.addEventListener is triggered by default ("message", function (e) {console.log ("the data sent by the server to the client is:" + e.data);}) / / if an error occurs, the error event eventSource.addEventListener ("error", function (e) {console.log ("server error data is" + e.data);});} else {console.log ("the server does not support EvenSource objects");} / / var count = 0 / / var comet = new iComet ({/ / channel: 'ch2', / / subUrl:', / / callback: function (content, type) {/ / count + +; / / var output = document.getElementById ('output'); / / var time =''+ (new Date ()) / / output [XSS _ clean] + = count +'. '+ time +': ('+ type +')'+ content +'; / /} /})
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.