1.2.0 • Published 10 years ago

gaffa-longpoll v1.2.0

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

gaffa-longpoll

longpoll behaviour for gaffa

Install:

npm i gaffa-longpoll

Add to gaffa:

gaffa.behaviours.constructors.longpoll = require('gaffa-longpoll');

API

Properties (instanceof Gaffa.Property)

url

The url to hit for the request

source

Data to send to the server each request

target

Data to store after each successful response

condition

whether to trigger the behaviour.

repoll

whether to repoll after a request ends, either in error or success.

This property is passed;

status, error if the request errored, data if the request succeded.

Example:

// Repoll if the request 200's
longpoll.repoll.binding = '(== status 200)';

dataType

what dataType you expect the server to respond with.

either 'json' or 'text'

default is 'json'

method

the http verb to send, GET, PUT, POST etc...

minPollTime

The minimum time between making a second poll request in milliseconds.

Defaulted to 3000ms

If a poll takes 5000ms to respond, it will repoll immediately. If it takes 1000ms to respond, it will repoll in 2000ms.

1.2.0

10 years ago

1.1.0

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago