unable to connect to Google Cloud Connection Server
Asked Answered
R

3

4

I'm trying to open a XMPP connection between my server and the Google Cloud Connection Server (CCS), but it doesn´t work. I´m programming with PHP and using the JAXL library. Here is my code:

<?php
include_once 'jaxl.php';

$client = new JAXL(array(
     'jid'=>'<my_sender_ID>@gcm.googleapis.com',
     'pass'=>'my_API_key',
     'auth_type'=>'PLAIN',
     'host' => 'gcm.googleapis.com',
     'port' => '5235',
     'force_tls' => true
)); 
$client->start();
echo "done";
?>

And then I get this error:

unable to connect tcp://gcm.googleapis.com:5235 with error no: 110, error str: Connection timed out

what am I doing wrong?

Roundish answered 19/6, 2013 at 11:29 Comment(1)
From a pure networking point of view Connection timed out normally means connectivity problem so I would check PING and firewall and possibly use NMAP to see if port 5235 is accessible.Tater
B
4

You should connect to gcm.googleapis.com by ssl, not http or tcp.

I fixed this by modifying jaxl.php from:

public function get_socket_path() {
    return ($this->cfg['port'] == 5223 ? "ssl" : "tcp")."://".$this->cfg['host'].":".$this->cfg['port'];
}

to:

public function get_socket_path() {
    return ($this->cfg['port'] == 5223 || $this->cfg['ssl'] == true ? "ssl" : "tcp")."://".$this->cfg['host'].":".$this->cfg['port'];
}

After that you can initialize the client with:

$client = new JAXL(array(
    'jid' => '<your-API-key>@gcm.googleapis.com',
    'pass' => '<your-API-key>',
    'host' => 'gcm.googleapis.com',
    'port' => 5235,
    'force_tls' => true,
    'auth_type' => 'PLAIN',
    'strict' => FALSE,
    'ssl' => TRUE
));
Beforehand answered 23/9, 2013 at 13:0 Comment(1)
Can you please provide me with the code as I am trying to do the same. I made a CCSServer using java however want to shift down to php. I have tried everything, please help me out.Cumae
P
2

Also, when you initialize the client, use

'log_level' => JAXL_DEBUG

That will allow you to see everything that's sending or being received. In my case, I figured out that my project has not yet been whitelisted - I forgot to register it on https://services.google.com/fb/forms/gcm/

jaxl_socket_client:189 - 2013-10-04 08:11:58 - <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><temporary-auth-failure/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Project 1012343798740 not whitelisted.</text></failure>
Portaltoportal answered 4/10, 2013 at 9:9 Comment(0)
T
0

Perhaps you should change the host to http://gcm.googleapis.com. Your error says "unable to connect tcp://gcm.googleapis.com:5235".

GCM Cloud Connection Server (CCS) is an XMPP endpoint, running on http://gcm.googleapis.com port 5235.

Tarver answered 19/6, 2013 at 14:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.