https://github.com/strophe/strophejs-plugin-roster
https://github.com/strophe/strophejs-plugin-roster
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/strophe/strophejs-plugin-roster
- Owner: strophe
- License: mit
- Created: 2017-01-25T13:41:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-12-03T13:43:29.000Z (over 4 years ago)
- Last Synced: 2025-06-15T15:54:39.142Z (11 months ago)
- Language: JavaScript
- Size: 33.2 KB
- Stars: 2
- Watchers: 13
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# strophejs-plugin-roster
strophe.roster.js is a plugin to provide Roster Versioning
([XEP-0237](https://xmpp.org/extensions/xep-0237.html)).
## Install
npm install strophejs-plugin-roster
## Usage
Make sure you include [Strophe](https://www.npmjs.com/package/strophe.js) first.
You should first initialize and authorize the plugin, then you can subscribe to presence updates for the people in your roster.
### Init connection
# `connection` is Strophe.Connection
connection.roster.init(connection)
var roster;
connection.roster.get(function (result) {
roster = result;
});
### Subscribe to updates
# 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');
### Update nick
connection.roster.update(jid, 'My Nick');
## API
### `.authorize(jid, message)`
### `.subscribe(jid, message, nick)`
### `.unsubscribe(jid, message)`
### `.add(jid, name, groups, callback)`
### `.update(jid, callback)`
### `.remove(jid, callback)`
### `.findItem(jid)`
### `.removeItem(jid)`