Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of Ajax long connection Project

Shulou Source: shulou.com Published: 2022-06-03 07:08:39 11月14日 Update

This article mainly introduces the example analysis of Ajax long connection project, which is very detailed and has certain reference value. Friends who are interested must finish it!

The so-called long connection is to constantly send requests, block the requests on the server side, resend the request every time the request time is exceeded, maintain the connection, and obtain the response data of the server side at any time.

Project case:

The code is as follows:

Function connection () {

$.ajax ({

Type: "GET"

Url: "/ api2/session/event?"

Data: {

"uid": obj.uid

"sessionID": "cool"

}

Success:function (serverData) {

Connection ()

}

Error:function (XMLHttpRequest, textStatus, errorThrown) {

Connection ()

}

});

}

The above is all the contents of the article "sample Analysis of the Ajax long connection Project". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Projects examples analysis content servers articles services constantly code value interests guys buddies that is data time more cases knowledge end Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Docker Xiaomi Microsoft vpn