Subscription
This object allows to make a subscription to the
PubSubManager.
A subscription can be made with the same set of constraints and
options
of a discover; after its creation,
the subscription expires in 1 hour.
Once expired, the subscription can optionally be Subscription/renew:method
and subscribed again to the PubSubManager.
Each subscription must be associated to the same "client identifier"; this way each API client can retrieve from the
PubSubManager only its own subscriptions (and it will not be able to retrieve subscriptions made by other clients).
Note: if a subscription with the specified label
and clientID
is already subscribed, this subscription will be rejected. See also
SUBSCRIPTION_REJECTED error
var constraints = {
"where": {
"south": -10,
"west": -20,
"north": 10,
"east": 20
},
"when": {
"from" : "2000-01-01",
"to": "2013-01-01"
},
"what": "water"
}
var clientID = 'example-client-ID';
var subscription = GIAPI.Subscription('example-label',constraints,clientID);
var creDate = subscription.creation();
var expDate = subscription.expiration();
Constructor
Subscription
-
label
-
constraints
-
clientID
Parameters:
-
label
Stringa label to describe this subscription. If a subscription with the specified
label
andclientID
is already subscribed, this subscription will be rejected. See also SUBSCRIPTION_REJECTED error -
constraints
Objectan object with the constraints of this subscription (see also DAB discover constraints)
-
clientID
Stringa string which identifies this API client. If a subscription with the specified
label
andclientID
is already subscribed, this subscription will be rejected. See also SUBSCRIPTION_REJECTED error
Item Index
Methods
Methods
clientID
-
clientID
Returns and/or set the client ID associated to this subscription.
Parameters:
-
clientID
Stringa string to which identifies this API client
Returns:
the client ID associated to this subscription
constraints
-
constraints
Returns and/or set the constraints of this subscription.
Parameters:
-
constraints
Objectan object with the constraints of this subscription (see also DAB discover constraints)
Returns:
the constraints of this subscription
expiration
()
Date
id
()
String
Returns the unique identifier of this subscription.
Returns:
the unique identifier of this subscription
label
-
label
Returns and/or set the label of this subscription.
Parameters:
-
label
Stringa label to describe this subscription
Returns:
the label of this subscription
options
-
options
Returns and/or set the options of this subscription.
Parameters:
-
options
Objectan object with the options of this subscription (see also DAB discover options)
Returns:
the options of this subscription