Protoco...:Stream(3)
π Protocol::XMPP::Stream β handle XMPP protocol stream π¦
okay so this is a page from the User Contributed Perl Documentation, and it's literally all about Protocol::XMPP::Stream, which handles the XMPP protocol stream. bestie, if you're doing XMPP in Perl, this is your girl π
β¨ SYNOPSIS β¨
ngl there's genuinely nothing here β the synopsis section is empty in the original. iconic of her honestly π no examples, no one-liners, we just go straight to the good stuff.
πΈ DESCRIPTION πΈ
(nothing in the description section either β she's mysterious like that π )
π METHODS π
π new
Instantiate a stream object π« used for interacting with the underlying XMPP stream.
Takes these parameters as callbacks:
on_queued_writeβ this will be called whenever there is data queued to be written to the socketon_starttlsβ this will be called when we want to switch to TLS mode
and these scalar parameters:
userβ username (not the full JID, just the first part)passβ password
π on_data
Data has been received π pass it over to the SAX parser to trigger any required events.
π queue_write
Queue up a write for this stream. Adds to the existing send buffer array if there is one.
When a write is queued, this will send a notification to the on_queued_write callback if one was defined. π¬
π write_buffer
Returns the contents of the current write buffer without changing it β peek, don't touch, we respect boundaries here π«Ά
π extract_write
Retrieves the next pending message from the write buffer and removes it from the list. it's giving "you've been served" π
π ready_to_send
Returns true if there's data ready to be written. vibe check: passed β
π reset
Reset this stream.
Clears out the existing SAX parsing information and sets up a new Protocol::XMPP::Handler ready to accept events. Used when we expect a new "<stream"> element, for example after authentication or TLS upgrade π
π dispatch_event
Call the appropriate event handler.
Currently defined events:
featuresβ we have received the features list from the serverloginβ login was completed successfullymessageβ a message was receivedpresenceβ a presence notification was receivedsubscriptionβ a presence notification was receivedtransfer_requestβ a file transfer request has been receivedfileβ a file was received
(and yes, subscription and presence are both described as "a presence notification was received" β that's exactly what the original says, so I'm not touching it π she said what she said)
π preamble
Returns the XML header and opening stream preamble β¨
π jid
Returns the full JID for our user π
If given a parameter, will set the JID to that value, extracting hostname and user by splitting the domain.
π user
Username for SASL authentication.
π pass
Password for SASL authentication. π€«
π hostname
Name of the host π
π resource
Fragment used to differentiate this client from any other active clients for this user (as defined by bare JID). it's your little name tag so the server knows which one of you is which π
π write_xml
Write a chunk of XML to the stream, converting from the internal representation to XML text stanzas π§
π write_text
Write raw text to the output stream.
π login
Process the login.
Takes optional named parameters:
userβ username (not the full JID, just the user part)passwordβ password or passphrase to use in SASL authentication
π is_authorised
Returns true if we are authorised already.
π is_loggedin
Returns true if we are logged in already.
π stream
Override the ->stream method from the base class so that we pick up our own methods directly. main character energy: she's not borrowing anyone's methods, she's got her own π₯
π next_id
Returns the next ID in the sequence for outgoing requests π’
π on_tls_complete
Continues the next part of the connection when TLS is complete π
π compose
Compose a new outgoing message βοΈ
π subscribe
Subscribe to a new contact. Takes a single JID as target.
π unsubscribe
Unsubscribe from the given contact. Takes a single JID as target. π
π authorise
Grant authorisation to the given contact. Takes a single JID as target. β
π deauthorise
Revokes auth for the given contact. Takes a single JID as target. β
π AUTHOR π
Tom Molesworth <tom@perlsite.co.uk> β legend behaviour, fr fr π«Ά
π LICENSE π
Copyright Tom Molesworth 2010-2026. Licensed under the same terms as Perl itself.
lowkey the most important part: every single flag, callback, parameter and event above is exactly as the original says it. no cap, no invented tips, no extras π
and that's the whole page bestie π¦π this was Protoco...:Stream(3) from the User Contributed Perl Documentation, page generated with perl v5.42.2 on 2026-02-15 β slay, go build something iconic with it β¨π
π¦ where this page comes from
- alpine 3.24: perl-protocol-xmpp-doc 0.007-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms