gaffa-longpoll
v1.2.0
Published
A longpoll behaviour for gaffa applications
Downloads
3
Readme
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.