Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/izumi-kun/jquery-longpoll-client
Simple client-side longpoll implementation
https://github.com/izumi-kun/jquery-longpoll-client
ajax comet javascript jquery jquery-longpoll-client
Last synced: 28 days ago
JSON representation
Simple client-side longpoll implementation
- Host: GitHub
- URL: https://github.com/izumi-kun/jquery-longpoll-client
- Owner: Izumi-kun
- License: bsd-3-clause
- Created: 2017-01-27T11:13:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-20T09:11:54.000Z (over 7 years ago)
- Last Synced: 2024-11-16T18:20:47.558Z (about 1 month ago)
- Topics: ajax, comet, javascript, jquery, jquery-longpoll-client
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# jQuery LongPoll client script
Simple client-side longpoll implementation.
## Usage
### Create
```javascript
var config = {
url: '/url/to/polling',
params: {t: 1485714246},
callback: function (data) {
// your callback function
console.log(data);
}
};
jQuery.longpoll.register('myId', config).start();
```The server should return JSON data in follow structure:
```json
{
"params": {"t": 1485714250},
"data": "any kind of data will be passed to callback function"
}
```### Stop
```javascript
jQuery.longpoll.get('myId').stop();
```### Destroy
```javascript
jQuery.longpoll.destroy('myId');
```License
-------
BSD-3-Clause