Class: ExponentialReExpress

ExponentialReExpress

new ExponentialReExpress()

An ExponentialReExpress uses an internal onTimeout to express the interest again with double the interestLifetime. See ExponentialReExpress.makeOnTimeout, which you should call instead of the private constructor. Create a new ExponentialReExpress where onTimeout expresses the interest again with double the interestLifetime. If the interesLifetime goes over settings.maxInterestLifetime, then call the given onTimeout. If this internally gets onData, just call the given onData.
Source:

Methods

(static) makeOnTimeout(face, onData, onTimeout, settings) → {function}

Return a callback to use in expressInterest for onTimeout which will express the interest again with double the interestLifetime. If the interesLifetime goes over maxInterestLifetime (see settings below), then call the provided onTimeout. If a Data packet is received, this calls the provided onData. Use it like this: var onData = function() { ... }; var onTimeout = function() { ... }; face.expressInterest (interest, onData, ExponentialReExpress.makeOnTimeout(face, onData, onTimeout));
Parameters:
Name Type Description
face Face This calls face.expressInterest.
onData function When a matching data packet is received, this calls onData(interest, data) where interest is the interest given to expressInterest and data is the received Data object. This is normally the same onData you initially passed to expressInterest. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.
onTimeout function If the interesLifetime goes over maxInterestLifetime, this calls onTimeout(interest). However, if onTimeout is null, this does not use it. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.
settings Object (optional) If not null, an associative array with the following defaults: { maxInterestLifetime: 16000 // milliseconds }
Source:
Returns:
The onTimeout callback to pass to expressInterest.
Type
function