AnyEvent::XMPP(3)
π AnyEvent::XMPP β the manual page, bestie edition π
AnyEvent::XMPP(3) Β· User Contributed Perl Documentation Β· AnyEvent::XMPP(3)
okay so you found the head module of the AnyEvent::XMPP XMPP client protocol framework, and honestly? you're in the right place. grab a snack π
β¨ NAME β¨
AnyEvent::XMPP β an implementation of the XMPP Protocol. that's the whole name. iconic, brief, does what it says π
π¦ VERSION π¦
Version 0.55. yes, bestie, that's the number. write it down π
πΈ SYNOPSIS πΈ
like, literally start here:
use AnyEvent::XMPP::Connection;
or, if that's not your vibe:
use AnyEvent::XMPP::IM::Connection;
or, the third option, the multiverse option:
use AnyEvent::XMPP::Client;
pick your fighter, they're all valid π«Ά
π DESCRIPTION π
so this is the head module of the AnyEvent::XMPP XMPP client protocol framework β the one described in RFC 3920 and RFC 3921. yes, both. it's giving "academic but make it chat" β¨
AnyEvent::XMPP::Connection is a RFC 3920 conforming "XML" stream implementation for clients β it handles the TCP connect all the way up to the resource binding. and it gives you low level access to the XML nodes on the XML stream, plus some high level methods to send the predefined XML stanzas. it's the "I'll do the plumbing, you do the personality" of the family π§
AnyEvent::XMPP::IM::Connection is the more high level one, and it's derived from AnyEvent::XMPP::Connection. it handles all the instant messaging client functionality described in RFC 3921. all of it. no crumbs π
AnyEvent::XMPP::Client is the multi account client class. it manages connections to multiple XMPP accounts and tries to offer a nice high level interface to XMPP communication. main character energy, managing all her group chats at once π
for a list of "Supported extensions" see below (yes, that's a real section, keep scrolling bestie).
there are also other modules in this distribution, for example: AnyEvent::XMPP::Util, AnyEvent::XMPP::Writer, AnyEvent::XMPP::Parser and those I forgot :-). those modules might be helpful and/or required if you want to use this framework for XMPP. the "I forgot" is doing so much work here and I respect it π
also see AnyEvent::XMPP::Writer for a discussion about the brokenness of XML in the XMPP specification. it's a whole thing. we don't have time.
if you have any questions or seek for help look below under "SUPPORT". (not in this part, but it's down there somewhere, iykyk)
π§ REQUIREMENTS π§
one of the major drawbacks I see for AnyEvent::XMPP is the long list of required modules to make it work. and like, it is long. buckle up π
AnyEventβ for the I/O events, timers, TCP, TLS, DNS and I/O buffering. the whole nervous system basically.Object::Eventβ the formerAnyEvent::XMPP::Eventmodule has been outsourced to theObject::Eventmodule to provide a more generic way for more other modules to register and call event callbacks. glow up moment β¨XML::Writerβ for writing "XML". (the quotes are load-bearing, trust)XML::Parser::Expatβ for parsing partial "XML" stuff. partial. stuff. you get it.MIME::Base64β for SASL authentication πAuthen::SASLβ for SASL authentication π (yes, again, they're a duo)Net::LibIDNβ for stringprep profiles to handle JIDs.Digest::SHAβ for component authentication and old-style authentication.
and yes, all these are essential for XMPP communication. even though 'instant messaging' and 'presence' is a quite simple problem, XMPP somehow was successful at making the task complicated enough to keep me busy for a long time. the way that a simple concept got β¨complicatedβ¨. but all of that time wasn't only for the technology required to get it started, mostly it was for all the quirks, hacks and badly applied "XML" in the protocol which complicated the matter. rip to my free time, it ate it π
β RELEASE NOTES β
here are some notes to the last releases (release of this version is at top):
π Version
0.55β Bugfixes, see Changes file. short and sweet.0.54β AddAnyEvent::XMPP::Ext::Receipts, small bugfixes, see Changes file.0.53β Maintenance release. Patches for various small issues, see Changes file.0.52β Maintenance release. (that's it. that's the note. she said what she said)0.51β Maintenance release. Added a patch which fixesObject::Eventcompatibility and another fix w.r.t. memory leak in the parser. And added the original node toAnyEvent::XMPP::IM::Message(thanks go tomons@cpan.org). π«Ά
NOTE: Version 0.6 of AnyEvent::XMPP will be API incompatible! If you are already eager to try the new version out contact me!
0.5β Maintenance release. Added a patch from Marcus Dubois forExt::Pubsub. Also fixed some memleaks inAnyEvent::XMPP::Parser. also wanted to note that the next version of AnyEvent::XMPP will have an incompatible API. if you are eager to try out the new complete rewrite of AnyEvent::XMPP contact me. π0.4β Minor fixes and feature enhancements: Addedold_style_ssloption for direct port5223SSL connections. Providing 'get_own_contact' for keeping track of own resources. TheAnyEvent::XMPP::Ext::MUCextension was rewritten and provides a more sane API now. slay π For details consult the Changes file in the distribution.0.3β Fixed some small bugs and improved documentation a bit, especially w.r.t. parameter passing of host and ports. the docs ate, fr fr.0.2β Renamed module fromNet::XMPP2toAnyEvent::XMPP.Net::XMPP2is herby deprecated! πͺ¦ Rewrote the low-level socket stuff to useAnyEvent::SocketandAnyEvent::Handle. Removed blocking write functionality, which can't be supported that easily withAnyEvent::Handle(however, if you want to wait until the send-buffer is empty you best use the "send_buffer_empty" event ofAnyEvent::XMPP::Connection). noted. lowkey important. π For more details consult the Changes file of the AnyEvent::XMPP distribution.olderβ For older release notes please have a look at the Changes file or CPAN.
π¦ TODO
there are still lots of items on the TODO list (see also the TODO file in the distribution of AnyEvent::XMPP). lots. of. items. π«
π TEST SUITE π
if you are a developer and want to test either a server or maybe just whether this module passes some basic tests you might want to run the developer test suite. go off, tester π
this test suite is not enabled by default because it requires some human interaction to set it up, please see AnyEvent::XMPP::TestClient for hints about the setup procedure for the test suite. yes, a human. you. specifically you. π
I wrote the test suite mostly because I wanted to make sure I didn't break something essential before a release. the tests don't cover everything and I don't plan to write a test for every single function in the API, that would slow down development considerably for me. but I hope that some grave show stopper bugs in releases are prevented with this test suite. reasonable queen behavior honestly π
the tests are also useful if you want to test a server implementation. but there are maybe of course conformance issues with AnyEvent::XMPP itself, so if you find something where AnyEvent::XMPP doesn't conform to the XMPP RFCs or XEPs consult the BUGS section below. (again, not in this part β hold that thought π«Ά)
if you find a server that doesn't handle something correctly but you need to interact with it you are free to implement workarounds and send me a patch, or even ask me whether I might want to look into the issue (I can't guarantee anything here, but I want this module to be as interoperable as possible. but if the implementation of a workaround for some non-conformant software will complicate the code too much I'm probably not going to implement it.). boundaries! we love to see them β¨
of course, if you find a bug in some server implementation don't forget to file a bugreport to them, one hack less in AnyEvent::XMPP means more time for bug fixing and improvements and new features. everyone wins π
πΈ Why (yet) another XMPP module? πΈ
the main outstanding feature of this module in comparison to the other XMPP (aka Jabber) modules out there is the support for AnyEvent. AnyEvent permits you to use this module together with other I/O event based programs and libraries (ie. Gtk2 or Event). it's giving "plays well with others" π
the other modules could often only be integrated in those applications or libraries by using threads. I decided to write this module because I think CPAN lacks an event based XMPP module. Threads are unfortunately not an alternative in Perl at the moment due the limited threading functionality they provide and the global speed hit. I also think that a simple event based I/O framework might be a bit easier to handle than threads. π§΅β
another thing was that I didn't like the APIs of the other modules. in AnyEvent::XMPP I try to provide low level modules for speaking XMPP as defined in RFC 3920 and RFC 3921 (see also AnyEvent::XMPP::Connection and AnyEvent::XMPP::IM::Connection). but I also try to provide a high level API for easier usage for instant messaging tasks and clients (eg. AnyEvent::XMPP::Client). best of both worlds, no cap π
π Supported extensions π
see AnyEvent::XMPP::Ext for a list. that's the whole section. go look, it's cute over there π¦
β¨ EXAMPLES β¨
Okay bestie, this is the fun part β there are actual runnable scripts shipped with this distro, like little starter packs π. Here's the full tour:
samples/simple_example_1β the "hello world" of this whole situation. It just connects to a server, sends a message, and prints whatever comes back on stdout. Baby's first XMPP connection fr fr.samples/conference_listerβ see below πsamples/room_listerβ see below πsamples/room_lister_statβ so these three together do a whole global room scan, and ngl it's kind of iconic:conference_listertakes a list of servers. That list lives in a file calledservers.xml, which has the same format as the xml file at <http://www.jabber.org/servers.xml>. It scans every server for chat room services and writes them out to a file calledconferences.storβ which is a Storable dump.room_listerreads that file back, then queries all the services for rooms, and then all the rooms for their occupants. The output goes toroom_data.stor, also a Storable dump πΎ.room_lister_statreads that and turns those data structures into something a human can actually read. Slay.
Fair warning: these scripts are a bit hacky and quite complicated, but maybe they'll be of some value to someone out there π. Also peep EVQ.pm in samples β that's a module that handles request-throttling. Trust, you do not want to flood the server and risk getting the admins' attention :)
samples/simple_componentβ a (basic) skeleton for a jabber component. Nice little starting point β¨samples/simple_oob_retrieverβ a simple out-of-band file transfer receiver bot. It usescurlto fetch the files, and it's also got this sample functionality where it'll send a file url to anyone who messages the botsend <filename>. Cute, honestly.samples/simple_register_exampleβ lets you register, unregister, and change your password for accounts. Run it with no arguments for more deets πsamples/disco_infoβ a small example tool that fetches the software version, disco info, and disco items info about a JID. Very "let me just look you up" energy πsamples/talkbotβ a simple bot that reads lines from a file and recites them when you send it a message. It'll also automatically let you subscribe to it. Start it with no commandline arguments and it'll tell you how to use it. Obsessed with this one πsamples/retrieve_rosterβ a simple example script that retrieves the roster for an account and prints it to stdout. You start it like this:
samples/# ./retrieve_roster <jid> <password>
samples/display_avatarβ a little example that should display the avatar of the account you connect to. Used like this:
samples/# ./display_avatar <jid> <password>
For the others β the ones the author might've forgot about or just didn't feel like listing here β go look in the samples/ directory, bestie. There's more in there π¦
More examples will be included in later releases, and please, feel free to ask the AUTHOR if you've got questions about the API. There's also an IRC channel, see SUPPORT π
π AUTHOR π
Robin Redeker, <elmex at ta-sa.org>, JID: <elmex at jabber.org>
π BUGS π
Okay so real talk: the author notes that he was, at the time of writing (July 2007), the only developer on this project, and he's very busy with his studies in Computer Science π. So if you want to ease his workload or you want timely releases β please send him patches instead of bug reports or feature requests. That's the move, fr fr.
He won't forget the reports or requests if you can't or didn't send patches, but he can't gurantee immediate response. He will of course try to fix/implement them as soon as possible! π«Ά
Also, try to be as precise as possible with bug reports. If you can't send a patch, the next best thing is to find out which code doesn't work and tell him why π
Please report any bugs or feature requests to bug-net-xmpp2 at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-XMPP>. He'll be notified, and then you'll automatically be notified of progress on your bug as he makes changes. Slay β¨
π«Ά SUPPORT π«Ά
You can find documentation for this module with the perldoc command:
perldoc AnyEvent::XMPP
You can also look for information at:
- IRC: AnyEvent::XMPP IRC Channel
IRC Network: http://freenode.net/
Server : chat.freenode.net
Channel : #ae_xmpp
Feel free to join and ask questions! Come hang out π¬
- AnyEvent::XMPP Project Site
<http://www.ta-sa.org/net_xmpp2>
- AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/AnyEvent-XMPP>
- CPAN Ratings
<http://cpanratings.perl.org/d/AnyEvent-XMPP>
- RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=AnyEvent-XMPP>
- Search CPAN
<http://search.cpan.org/dist/AnyEvent-XMPP>
π ACKNOWLEDGEMENTS π
Thanks to the XSF for the development of an open instant messaging protocol β even though it uses XML π (affectionate).
And thanks to all the people who had to listen to his desperate curses about the brokenness/braindeadness of XMPP. Without you, this module would've never been brought to a usable state. Genuinely, thank you ππ
Thanks to:
- J. Cameijo Cerdeira β for pointing out a serious bug in
split_jidin AnyEvent::XMPP::Util and suggesting adding a timeout argument to theconnectmethod of AnyEvent::XMPP::SimpleConnection. Iconic catch π - Carlo von Loesch (aka lynX) <http://www.psyced.org/> β for pointing out some typos π¦
- All other people .. β ... he mentioned in the
CONTRIBUTORSfile which comes with the AnyEvent::XMPP distribution.
β COPYRIGHT & LICENSE β
Copyright 2007, 2008 Robin Redeker, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
And that's the whole page, bestie β this copy came from perl v5.42.2, dated 2026-02-15, under the AnyEvent::XMPP(3) manpage title. Go forth and connect responsibly π
π
π¦ where this page comes from
- alpine 3.24: perl-anyevent-xmpp-doc 0.55-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