Class Attention


  • public final class Attention
    extends Object
    The implementation of the <attention/> element in the urn:xmpp:attention:0 namespace.

    XEP-0224: Attention

    This feature is known as 'nudge' or 'buzz' in some non-XMPP IM protocols.

    Listening for Attention Requests

    If you want to listen for inbound attention requests, listen for inbound messages and check if they have the Attention extension.

    
     xmppClient.addInboundMessageListener(e -> {
         if (e.getMessage().hasExtension(Attention.class)) {
             // Handle attention request.
         }
     });
     

    You should also enable this feature (preferably before login), in order to register this extension in service discovery:

    
     xmppClient.enableFeature(Attention.NAMESPACE);
     

    Requesting Attention

    Attention requests are sent via a 'headline' message:

    
     Message message = new Message(jid, Message.Type.HEADLINE);
     message.addExtension(Attention.INSTANCE);
     xmppClient.send(message);
     

    This class is immutable.

    See Also:
    XEP-0224: Attention, XML Schema