This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 195
Keepalive and Keepaliveprovider
Jim Myrah edited this page Jul 21, 2015
·
2 revisions
Keepalive
will use a timeout to periodically wake, broadcast a Keepalive
event on the root scope, and optionally make an $http
request. By default, the Idle
service will stop and start Keepalive
when a user becomes idle or returns from idle, respectively. It is also started automatically when Idle.watch()
is called. This can be disabled by configuring the IdleProvider
.
The following methods can be used to configure the Keepalive
service:
-
http(value) (
string
orobject
, default isnull
): If configured, these options will be used to issue a request using$http
. If the value is null, no HTTP request will be issued. You can specify a string, which it will assume to be a URL to a simple GET request. Otherwise, you can use the same options$http
takes. However,cache
will always befalse
. -
interval(seconds) (
integer
, default is 10 minutes): Must be greater than 0. This specifies how often the Keepalive event is triggered and the HTTP request is issued.
-
start(): Starts pinging periodically until
stop()
is called. - stop(): Stops pinging.
- ping(): Performs one ping only.
-
setInterval(seconds): Changes the interval value at runtime. You will need to restart the pinging process by calling
start()
manually for the changes to be reflected.
The following events are issued on the root scope:
- Keepalive (no arguments): Each time a ping is to be made.
-
KeepaliveResponse (
event
,data
,status
): Each time an HTTP request has completed or failed when pinging.