Skip to content

Instantly share code, notes, and snippets.

@clowestab
Created August 3, 2017 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clowestab/2cc4e8a07e7585438052368f48553cb5 to your computer and use it in GitHub Desktop.
Save clowestab/2cc4e8a07e7585438052368f48553cb5 to your computer and use it in GitHub Desktop.
<?php
//Initialize
$this->client = new JAXL(array(
'jid' => $this->senderId .'@gcm.googleapis.com',
'pass' => $this->googleApiKey,
'auth_type' => 'PLAIN',
'host' => $this->host,
'port' => $this->port,
'strict' => false,
'force_tls' => true,
'log_level' => JAXL_DEBUG,
'protocol' => 'tls'
));
//add a callback for authorisation success
$this->client->add_cb('on_auth_success', function() {
$this->client->set_status("available!", "dnd", 10);
//send your messages
$this->sendYourMessages();
});
//start the client
$this->client->start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment