class XMPP::PEP

Overview

PEP is a high-level client for XEP-0163 - Personal Eventing Protocol.

PEP lets a user publish items on their own pubsub nodes and subscribe to the nodes of other contacts. The server advertises PEP support with the disco feature "http://jabber.org/protocol/pubsub#pep".

Incoming notifications arrive as Message stanzas carrying a Stanza::PubSubEvent payload and are handled like any other message:

client.on("message") do |s, p| if event = p.as(XMPP::Stanza::Message).get(XMPP::Stanza::PubSubEvent) # event.items.node, event.items.items ... end end

See: https://xmpp.org/extensions/xep-0163.html

Defined in:

xmpp/pep.cr

Constant Summary

NS_PEP = "http://jabber.org/protocol/pubsub#pep"

Disco feature advertised by servers that support PEP.

Constructors

Instance Method Summary

Constructor Detail

def self.new(client : Client) #

[View source]

Instance Method Detail

def publish(node : String, item : Stanza::Item) #

publish sends an item to one of the client's own nodes. The item payload is a Stanza::Item (typically carrying a Tune or Mood).


[View source]
def publish_with_options(node : String, item : Stanza::Item, options : Stanza::PublishOptions) #

publish_with_options sends an item together with a publish-options form (XEP-0410), configuring the node (e.g. its access model) at publish time.


[View source]
def subscribe(jid : String, node : String) #

subscribe subscribes the client to a node owned by the given bare JID.


[View source]
def supported?(timeout : Time::Span = 5.seconds) : Bool #

supported? queries the server for PEP support on the client's own bare JID and returns true when PEP is advertised. Per XEP-0163 ยง4.1 a PEP server advertises the disco identity pubsub/pep; the http://jabber.org/protocol/pubsub#pep feature is a common extra signal.


[View source]
def unsubscribe(jid : String, node : String) #

unsubscribe removes the client's subscription to a node owned by the given bare JID.


[View source]