Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Send Push Notifications with Laravel & Arrow

Send Push Notifications with Laravel & Arrow

Ti Meetup Talk 20015-10-07 (http://www.meetup.com/TitaniumNL/events/224900273/)

Schedule and send APNs + GCM Push Notfications with a custom payload to your Titanium apps using a custom Laravel backend via Appcelerator Arrow Cloud (ACS).

Frank Eijking

October 07, 2015
Tweet

More Decks by Frank Eijking

Other Decks in Programming

Transcript

  1. @karaoak Objectives • Fast implementation. • Low costs, with possibly

    a high volume of registered users and/or devices. • Possibility to send and schedule PNs to individual users/devices with a custom payload. • Cross platform!
  2. @karaoak How do Push Notifications actually work? iOS / Mac

    OS X Your backend Ti app developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/ RemoteNotificationsPG/Chapters/ApplePushService.html Apple Simplistically… token + payload
  3. @karaoak Available Options • (M)BaaS • Parse • Kinvey •

    PushWoosh • ACS • Notificare • Self hosted backend
  4. @karaoak Available Options Ti Android support not optimal Capped, expensive

    No *free* remote API access You need an ACS account Expensive Time consuming, certificates, SLA • (M)BaaS • Parse • Kinvey • PushWoosh • ACS • Notificare • Self hosted backend
  5. @karaoak Solution • Fast implementation • Unified Ti app client

    module is already available: ricardoalcocer/acspushmod • No server side GCM and APNs certificate setup. • Unified platform agnostic ACS API, not likely to change, even when Google or Apple change API signature. • Custom backend • Full control with regard to scheduling, ACS has a limit of 100. • Custom client web interface with restricted options and more ease of use than AppC Platform. ACS with a custom Laravel backend, because …
  6. @karaoak Device Registration ricardoalcocer/ acspushmod AppC Platform web admin ACS

    developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/ RemoteNotificationsPG/Chapters/ApplePushService.html optional Laravel
  7. @karaoak How it works / Setup cURL GCM APNs Ti

    Alloy App AcsPushMod JSON REST API ADMIN WEB INTERFACE RESTe Laravel App Arrow Cloud Push Notifications JSON REST API device registration > < notification Android iOS device token + payload device token + optionally channel token + payload custom api APPC ADMIN WEB INTERFACE
  8. @karaoak Ideally … github.com/HazemKhaled/TiPushNotification GCM + APNs setup including server

    certificates + f.i. GCM APNs Ti Alloy App TiPushNotification JSON REST API ADMIN WEB INTERFACE RESTe Laravel App device registration > < notification Android iOS device token + payload custom api device token TLS socket stream (iOS)
  9. @karaoak Developing the Laravel App • As a backend to

    multiple apps, thus ACS keys. • Via the backend API the Ti app should be able to schedule a push notification. • Commands, Jobs and Queue services. • Custom Admin Web Interface to monitor and send promotional push notifications. • Developer Resources …
  10. @karaoak Build APIs You Won't Hate • by Phil Sturgeon

    • Everybody and their brother’s dog wants an API, so you should probably learn how to build them. • apisyouwonthate.com
  11. @karaoak • laravel.com - The documentation is very good! •

    Aglio Markdown 2 API documentation
 npmjs.com/package/aglio / apiblueprint.org • forge.laravel.com - Painless PHP Servers • kr.github.io/beanstalkd/ Other Resources DEMO DEMO
  12. @karaoak class Acs {
 
 protected $apiUrl;
 protected $apiKey;
 protected

    $username;
 protected $password;
 protected $cookiePath;
 protected $_errors;
 
 public function __construct(App $app, Enviro {
 $this->app = $app;
 $this->environment = $environment;
 
 $this->apiUrl = config('acs.api_url');
 $this->apiKey = $this->getApiKey();
 $this->username = $this->getUsername();
 $this->password = $this->getPassword();
 
 $this->cookiePath = storage_path('acs/') 
 }