Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Connecting to prosody #27

Open
steinm opened this issue Nov 26, 2015 · 4 comments
Open

Connecting to prosody #27

steinm opened this issue Nov 26, 2015 · 4 comments
Labels

Comments

@steinm
Copy link

steinm commented Nov 26, 2015

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.

@parubabr
Copy link

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!

@youmad
Copy link

youmad commented May 26, 2018

@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.

@parubabr
Copy link

@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!

@steinm
Copy link
Author

steinm commented May 29, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants