Hi Matt,
You have to understand a little bit about how the various Client
classes work and also a bit how the various 'dialects' of the protocol
work.
The 'SASL negotiation failed' part indicates that you simply are not
successfully authenticating against the jabber server. In the 1.x
version, authentication failure is passed along within your error
event. From there you have to decide what it is the client is supposed
to do. Also with the Component class, it speaks a much simpler dialect
than the others when it comes to authenticating. See
http://www.xmpp.org/extensions/xep-0114.html for more information.
Client::Component is only intended to speak the above referenced
protocol (not to the letter, because I implemented it before this
document was produced). And it was only intended to be used with the
jabberd14 series of jabber server. I have no idea if ejabberd supports
this protocol, and if it does, it would need to be specifically
configured to manage a component::accept namespace connection.
More than likely the hanging is result of ejabberd being stupid and
simply accepting an XML snippet (ie. <handshake/>) that doesn't belong
the jabber:client namespace and not doing the proper thing (ie.
sending a <stream:error/>, then a </stream:stream>, and closing the
socket). And by accepting, I mean, not puking all over the connection
and letting you know that what you sent wasn't valid for the
namespace.
All in all it sounds like you need to take a crash course in
jabber/xmpp, get a better understanding of the protocol differences
that each Client class implements, and figure out what exactly it is
you are trying to do.
I highly suggest you read the RFCs on xmpp at
http://www.xmpp.org/rfcs/ . And lurk around [EMAIL PROTECTED]
if you are seriously considering doing any kind of jabber development.
You can pick up a bit about the history of Jabber vs. XMPP, the
reference server implementation first generation vs. the second
generation (and how each manages services), and just how wild and
varied the implementations can get when you get outside the core
protocol. Also, here is a simple cookbook of an echo client that uses
an XMPP connection via the Client::XMPP class:
http://pcj.jabberstudio.org/moniwiki/wiki.php/XMPPEchoClient
On a side note, part of the confusion and complication you seem to be
having is my fault and I accept the documentation for the 1.x code
isn't as good as it could be, but I never expected to be giving Jabber
101 lessons in the POD. I plan on doing a release of the 2.0 code this
week that will include better documentation with very thorough
examples using each specific dialect, and automated tests. The 2.0
code simplifies a lot (for me especially in terms of management since
I switched to object_states) when it comes to deciding which
connection to use and to make it more explicit for what each is to be
used.
I hope this helps somewhat
On 1/16/07, Matt Hicks <[EMAIL PROTECTED]> wrote:
I have ejabberd running as localhost. Users are connected and test chats
work
(console output below). Sadly, I don't have easy access to a different
jabber
server implementation for testing.
I'm using Poco::Jabber in a simple example (code below). The problem is
neither INITFINISH nor ERROREVENT are ever posted. It just hangs after
_child
(event trace output attached.)
The different client-specific modules (Legacy, XMPP, and J2) all produce
"SASL
Negotiation failed" warnings, if that's relevant. If so, why doesn't that
show up under PoCo::Jabber::Client::Component?
--Matt
---------------------------------------
ejabberd console output verifies working jabber server:
([EMAIL PROTECTED])3>
ejabberd_ctl:process(["connected-users"]).
[EMAIL PROTECTED]/Exodus
[EMAIL PROTECTED]/Exodus
0
---------------------------------------
Perl test code:
use POE qw/ Component::Jabber::Client::Component
Component::Jabber::Error /;
use POE::Filter::XML::Node;
use POE::Filter::XML::NS qw/ :JABBER :IQ /;
use YAML;
POE::Session->create(
options => { trace => 1, debug => 1 },
inline_states => {
_start => sub {
$_[KERNEL]->alias_set('My_Session');
POE::Component::Jabber::Client::Component->new(
IP => 'localhost',
PORT => '5222',
HOSTNAME => 'localhost',
USERNAME => 'poe',
PASSWORD => 'poe',
BIND_DOMAIN => 'localhost',
BIND_OPTION => 'default',
ALIAS => 'POCO',
STATE_PARENT => 'My_Session',
STATES => {
INITFINISH => 'My_Init_Finished',
INPUTEVENT => 'My_Input_Handler',
ERROREVENT => 'My_Error_Handler',
}
);
},
_stop => sub {
$_[KERNEL]->alias_remove('My_Session');
},
My_Init_Finished => \&My_Init_Finished,
My_Input_Handler => \&My_Input_Handler,
My_Error_Handler => \&My_Error_Handler,
},
);
sub My_Init_Finished {
print "\nInit finished\n\n";
print YAML::Dump( $_[ARG0] );
}
sub My_Input_Handler {
print "\nInput handler\n\n";
print YAML::Dump( $_[ARG0] );
}
sub My_Error_Handler {
print "\nError handler\n\n";
print YAML::Dump( $_[ARG0], $_[ARG1] );
}
POE::Kernel->run();
---------------------------------------
Simple trace output:
2 -> _start (from C:/Perl/site/lib/POE/Kernel.pm at 1404)
2 -> _child (from C:/Perl/site/lib/POE/Kernel.pm at 1420)
...hang...