unable to connect to Google Cloud Connection Server

前端 未结 3 1313
不知归路
不知归路 2021-01-03 07:14

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 librar

相关标签:
3条回答
  • 2021-01-03 07:24

    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.

    0 讨论(0)
  • 2021-01-03 07:25

    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
    ));
    
    0 讨论(0)
  • 2021-01-03 07:28

    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>
    
    0 讨论(0)
提交回复
热议问题