class

XMPP::Push

Inherits Reference / Object

Push is a high-level client for XEP-0357 - Push Notifications.

A client registers an app server (push service) with its own server so the server can notify the app server when a message arrives for a hibernating or offline session. Support is discovered via disco on the user's bare JID; enable/disable are IQ-sets addressed to the user's bare JID.

push = XMPP::Push.new(client) return unless push.supported? push.enable("push-5.client.example", "yxs32uqsflafdk3iuqo") push.disable("push-5.client.example")

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

Constants

NS_PUSH = "urn:xmpp:push:0"

Disco feature advertised by servers that support push notifications.

Constructors

new(client : Client)
Source

Instance methods

disable(jid : String, node : String | Nil = nil, timeout : Time::Span = 5.seconds) : Stanza::IQ | Nil

disable removes the push registration for the given push service (jid), optionally narrowed to a specific node. Returns the result/error IQ (nil on timeout).

Source
enable(jid : String, node : String, timeout : Time::Span = 5.seconds) : Stanza::IQ | Nil

enable registers the given push service (jid) and app-specific node with the server and returns the matching result/error IQ (nil on timeout). Callers check the returned IQ's type == "result".

Source
supported?(timeout : Time::Span = 5.seconds) : Bool

supported? queries the server for push support on the client's own bare JID and returns true when the urn:xmpp:push:0 feature is advertised (XEP-0357 ยง4.1).

Source