xmpp-php
xmpp-php copied to clipboard
TimeOut Connect Google Hangout
Hi @Norgul , I use your library and I try to connect with Google Hangout with this config
use Norgul\Xmpp\Options;
use Norgul\Xmpp\XmppClient;
class XmppController extends Controller
{
protected static $host = 'gmail.com';
protected static $port = 5222;
protected static $username = 'user_gmail'; // [email protected]
protected static $password = 'password_gmail';
public function __construct()
{
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
}
public function getMessage()
{
$options = new Options();
$options
->setHost(self::$host)
->setPort(self::$port)
->setUsername(self::$username)
->setPassword(self::$password);
$client = new XmppClient($options);
$client->connect();
$client->getRoster();
$client->sendMessage('Hello world', '[email protected]');
$client->getResponse();
do {
$client->getResponse();
} while (true);
}
}
but always request time out. can you help me ?
Hi @jrpikong would you mind telling me what version of the library are you using?
Hi @Norgul thank for your fast response,
this my version :
"norgul/xmpp-php": "^1.1",
@jrpikong first thing to notice is that you are using wrong host. For Google hangouts, the host should be talk.google.com
.
As for the timeout, I am pretty sure Google has some better verification system besides PLAIN
:) This is something I will need to take on and research, and implement new verification which can pass Google security issues.
On the side note, I tried to register myself to XMPP over Adium (it is like Pidgin, but for Mac) with my Google credentials and couldn't do so until I have enabled less secure apps in my Google account.
I'll get on it these days and try to make it work. You are also free to check out and contribute if you have some ideas.
I will wait dude
Hello again @jrpikong,
if you'd like to see the output of the library, you can forward a flag to $client->getResponse()
method ($client->getResponse(true)
).
I have tried again (with talk.google.com
host) and what I get is the following response:
HTTP/1.1 301 Moved Permanently Location: https://hangouts.google.com/
Even though some people say it is (was) possible to connect to the server, and even though I didn't implement TLS I am not sure at this point that I got the real host.
Still on it, but if you find out something useful I'd appreciate if you wrote it here. Thanks
I am closing this issue as I didn't found any resource pointing me in the right direction. oAuth2 may be implemented in future releases
I am reopening this issue. I had a bug (resolved now) which disabled the communication with google servers. Right host is talk.l.google.com
. I will look to implement Google auth in the next release