strophe.roster.js is a plugin to provide Roster Versioning (XEP-0237).
npm install strophejs-plugin-roster
Make sure you include Strophe first.
You should first initialize and authorize the plugin, then you can subscribe to presence updates for the people in your roster.
# `connection` is Strophe.Connection
connection.roster.init(connection)
var roster;
connection.roster.get(function (result) {
roster = result;
});
# a jid from your roster
var jid = 'username@your_xmpp_server';
// Subscribe to updates for the given JID
connection.roster.subscribe(jid, 'Online', 'Nick');
// Authorize the given JID to get updates from you
connection.roster.authorize(jid, 'Online');
connection.roster.update(jid, 'My Nick');