Skip to content

Commit 8e99c4b

Browse files
author
George Miller
committed
Auto grabs the public token to ensure we can swap it out every 60 mins
1 parent 1fa948a commit 8e99c4b

File tree

5 files changed

+255
-6
lines changed

5 files changed

+255
-6
lines changed
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
<?php namespace App\Http\Controllers;
22

3+
use Pushman\PHPLib\Pushman;
4+
35
class DemoController extends Controller {
46

57
public function index()
68
{
79
$className = 'nav-home';
8-
return view('demo.index', compact('className'));
10+
11+
$pm = new Pushman(env('PUSHMAN_PRIVATE_KEY'));
12+
$token = $pm->token('public');
13+
$token = $token['token'];
14+
15+
return view('demo.index', compact('className', 'token'));
916
}
1017
}

bootstrap/app.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
22

33
require_once __DIR__ . '/../vendor/autoload.php';
4-
5-
// Dotenv::load(__DIR__ . '/../');
4+
Dotenv::load(__DIR__ . '/../');
65

76
/*
87
|--------------------------------------------------------------------------

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"require": {
88
"laravel/lumen-framework": "5.0.*",
99
"vlucas/phpdotenv": "~1.0",
10-
"illuminate/html": "^5.0"
10+
"illuminate/html": "^5.0",
11+
"pushman/phplib": "^2.2"
1112
},
1213
"require-dev": {
1314
"phpunit/phpunit": "~4.0"

composer.lock

Lines changed: 243 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/views/demo/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function connect() {
257257
258258
// This token changes every 60 minutes automatically.
259259
// We use Serverside helpers so we never have to change the code.
260-
conn = new ab.Session('ws://live.pushman.dfl.mn:8080?token=zjVHWGbiI2fQjo1A2AQK',
260+
conn = new ab.Session('ws://live.pushman.dfl.mn:8080?token={{$token}}',
261261
function() {
262262
divLog('Connected to Pushman via Web Socket.');
263263
conn.subscribe('restart_warning', function(topic, data) {

0 commit comments

Comments
 (0)