[Ndn-lib] Closure deprecated in NDN-JS

Thompson, Jeff jefft0 at remap.UCLA.EDU
Thu May 14 09:13:38 PDT 2015


Hello NDN-JS users,

As mentioned in the previous message, NDNx support has been deprecated in NDN-JS. This also includes support for NDNx-style "Closure" callbacks in expressInterest and registerPrefix. A lot of old NDN-JS apps used Closure, so I wanted to bring special attention to this. For example your code may have something like:

var closure = {
  upcall: function(kind, upcallInfo) { ... }
};
face.expressInterest(name, closure);

NDN-JS will throw an exception "expressInterest with NDNx-style Closure is deprecated. To enable while you upgrade your code to use function callbacks, set WireFormat.ENABLE_NDNX = true". You need to change your code to use function callbacks for expressInterest and registerPrefix. For example:

var onData = function(interest, data) { ... };
var onTimeout = function(interest) { ... };
face.expressInterest(name, onData, onTimeout);

For details, see the Common Client Library API docs:
http://named-data.net/doc/ndn-ccl-api/face.html#face-expressinterest-methods
http://named-data.net/doc/ndn-ccl-api/face.html#face-registerprefix-method

To enable NDNx and Closure support while you upgrade your code, add this line to your main function:
WireFormat.ENABLE_NDNX = true;

In the next platform release (about 3 months), NDNx and Closure support will be completely removed. If you need help converting your code from Closure to function callbacks, send me a message.

Thank you,
- Jeff T
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndn-lib/attachments/20150514/02c67ffa/attachment.html>


More information about the Ndn-lib mailing list