xmpp icon indicating copy to clipboard operation
xmpp copied to clipboard

Connecting to prosody

Open steinm opened this issue 10 years ago • 4 comments

Is there a known problem when connecting to prosody?

I always get a

Uncaught exception 'Fabiang\Xmpp\Exception\Stream\StreamErrorException' with message 'Stream Error: "host-unknown"'

but the host can't be the problem. I can connect to it with pidgin without any problems.

steinm avatar Nov 26 '15 14:11 steinm

Hi! I am very new to xmpp world and have a similar issue. In my case, "host-unknown" error was caused when using complete jid as username. Try changing:

From: $options->setUsername('user@address')->setPassword('password'); To: $options->setUsername('user')->setPassword('password');

But even changing to the correct username I still cannot connect to Prosody. Here are what Prosody log says:

May 26 00:41:36 c2s844090 info Client connected May 26 00:41:36 c2s844090 info Stream encrypted (TLSv1.2 with ECDHE-RSA-AES256-GCM-SHA384) May 26 00:41:36 c2s844090 info Authenticated as user@address May 26 00:41:36 c2s844090 info Client disconnected: closed

Please, can anyone help? Thank you!

parubabr avatar May 26 '18 04:05 parubabr

@steinm please check this #71 and #38. (oh, I'm too late)

@pardalbr your server logs says that client connected and successfully authenticated. If you want a persistent connection then you could get it by using infinity loop (like there #12) or with reactphp/event-loop.

youmad avatar May 26 '18 05:05 youmad

@youmad , thank you for your reply! Ok, but strange thing it never send the message. Here is the entire code:

        $options = new Options('tcp://testserver.com:5222');
        $options->setUsername('admin')->setPassword('pass123');

        $client = new Client($options);
        $client->connect();

        $message = new Message;
        $message->setMessage('This is a test message!')->setTo('[email protected]');
        $client->send($message);

        $client->disconnect();

Please, could you help me with an example code on how to include a very simple debug psr/log, so I can identify what is going on? Must I also install Monolog for this?

Thanks! Best regards!

parubabr avatar May 26 '18 13:05 parubabr

I was finally able to connect without problems. Don't what I did differently. Could be, that I just used a new version.

steinm avatar May 29 '18 17:05 steinm