Open steinm opened 8 years ago
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!
@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 , 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('user1@testserver.com');
$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!
I was finally able to connect without problems. Don't what I did differently. Could be, that I just used a new version.
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.