The XEP-0030 service discovery API
This API lets you discover information about entities on the XMPP network.
- Source:
Namespaces
Methods
(static) getFeatures(jid) → {promise}
Return all the features associated with a disco entity
Parameters:
Name | Type | Description |
---|---|---|
jid |
string | The JID of the entity whose features are returned. |
- Source:
Returns:
A promise which resolves with the returned features
- Type
- promise
Example
const features = await api.disco.getFeatures('room@conference.example.org');
(static) getFeatures(jid) → {promise}
Return all the features associated with a disco entity
Parameters:
Name | Type | Description |
---|---|---|
jid |
string | The JID of the entity whose features are returned. |
Returns:
A promise which resolves with the returned features
- Type
- promise
Example
const features = await api.disco.getFeatures('room@conference.example.org');
(static) getFields(jid)
Return all the service discovery extensions fields associated with an entity.
Parameters:
Name | Type | Description |
---|---|---|
jid |
string | The JID of the entity whose fields are returned. |
- Source:
Example
const fields = await api.disco.getFields('room@conference.example.org');
(static) getFields(jid)
Return all the service discovery extensions fields associated with an entity.
Parameters:
Name | Type | Description |
---|---|---|
jid |
string | The JID of the entity whose fields are returned. |
Example
const fields = await api.disco.getFields('room@conference.example.org');
(static) getIdentity(The, type, jid) → {promise}
Get the identity (with the given category and type) for a given disco entity.
For example, when determining support for PEP (personal eventing protocol), you
want to know whether the user's own JID has an identity with
category='pubsub'
and type='pep'
as explained in this section of
XEP-0163: https://xmpp.org/extensions/xep-0163.html#support
Parameters:
Name | Type | Description |
---|---|---|
The |
string | identity category.
In the XML stanza, this is the |
type |
string | The identity type.
In the XML stanza, this is the |
jid |
string | The JID of the entity which might have the identity |
- Source:
Returns:
A promise which resolves with a map indicating whether an identity with a given type is provided by the entity.
- Type
- promise
Example
api.disco.getIdentity('pubsub', 'pep', _converse.bare_jid).then(
function (identity) {
if (identity) {
// The entity DOES have this identity
} else {
// The entity DOES NOT have this identity
}
}
).catch(e => log.error(e));
(static) getIdentity(The, type, jid) → {promise}
Get the identity (with the given category and type) for a given disco entity.
For example, when determining support for PEP (personal eventing protocol), you
want to know whether the user's own JID has an identity with
category='pubsub'
and type='pep'
as explained in this section of
XEP-0163: https://xmpp.org/extensions/xep-0163.html#support
Parameters:
Name | Type | Description |
---|---|---|
The |
string | identity category.
In the XML stanza, this is the |
type |
string | The identity type.
In the XML stanza, this is the |
jid |
string | The JID of the entity which might have the identity |
Returns:
A promise which resolves with a map indicating whether an identity with a given type is provided by the entity.
- Type
- promise
Example
api.disco.getIdentity('pubsub', 'pep', _converse.bare_jid).then(
function (identity) {
if (identity) {
// The entity DOES have this identity
} else {
// The entity DOES NOT have this identity
}
}
).catch(e => log.error(e));
(static) info(jid, nodeopt) → {promise}
Query for information about an XMPP entity
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
jid |
string | The Jabber ID of the entity to query |
|
node |
string |
<optional> |
A specific node identifier associated with the JID |
- Source:
Returns:
Promise which resolves once we have a result from the server.
- Type
- promise
(static) info(jid, nodeopt) → {promise}
Query for information about an XMPP entity
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
jid |
string | The Jabber ID of the entity to query |
|
node |
string |
<optional> |
A specific node identifier associated with the JID |
Returns:
Promise which resolves once we have a result from the server.
- Type
- promise
(static) items(jid, nodeopt) → {promise}
Query for items associated with an XMPP entity
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
jid |
string | The Jabber ID of the entity to query for items |
|
node |
string |
<optional> |
A specific node identifier associated with the JID |
- Source:
Returns:
Promise which resolves once we have a result from the server.
- Type
- promise
(static) items(jid, nodeopt) → {promise}
Query for items associated with an XMPP entity
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
jid |
string | The Jabber ID of the entity to query for items |
|
node |
string |
<optional> |
A specific node identifier associated with the JID |
Returns:
Promise which resolves once we have a result from the server.
- Type
- promise
(static) refresh(jid) → {promise}
Refresh the features, fields and identities associated with a disco entity by refetching them from the server
Parameters:
Name | Type | Description |
---|---|---|
jid |
string | The JID of the entity whose features are refreshed. |
- Source:
Returns:
A promise which resolves once the features have been refreshed
- Type
- promise
Example
await api.disco.refresh('room@conference.example.org');
(static) refresh(jid) → {promise}
Refresh the features, fields and identities associated with a disco entity by refetching them from the server
Parameters:
Name | Type | Description |
---|---|---|
jid |
string | The JID of the entity whose features are refreshed. |
Returns:
A promise which resolves once the features have been refreshed
- Type
- promise
Example
await api.disco.refresh('room@conference.example.org');
(static) refreshFeatures()
- Deprecated:
- Use api.disco.refresh instead.
- Source:
(static) refreshFeatures()
- Deprecated:
- Use api.disco.refresh instead.
- Source:
(static) supports(feature, jid) → {promise}
Used to determine whether an entity supports a given feature.
Parameters:
Name | Type | Description |
---|---|---|
feature |
string | The feature that might be
supported. In the XML stanza, this is the |
jid |
string | The JID of the entity (and its associated items) which should be queried |
- Source:
Returns:
A promise which resolves with true
or false
.
- Type
- promise
Example
if (await api.disco.supports(Strophe.NS.MAM, _converse.bare_jid)) {
// The feature is supported
} else {
// The feature is not supported
}
(static) supports(feature, jid) → {promise}
Used to determine whether an entity supports a given feature.
Parameters:
Name | Type | Description |
---|---|---|
feature |
string | The feature that might be
supported. In the XML stanza, this is the |
jid |
string | The JID of the entity (and its associated items) which should be queried |
Returns:
A promise which resolves with true
or false
.
- Type
- promise
Example
if (await api.disco.supports(Strophe.NS.MAM, _converse.bare_jid)) {
// The feature is supported
} else {
// The feature is not supported
}