Creating a
realtime dashboard
using PHP and websockets
Slide 2
Slide 2 text
About me
Freek Van der Herten
Partner & developer at SPATIE
@freekmurze
https://murze.be
Slide 3
Slide 3 text
About me
phpantwerp.be
Dries Vints
@driesvints
Frederick Vanbrabant
@TheEdonian
Slide 4
Slide 4 text
Since 2003
Websites, applications and webshops
Team
4 developers, 1 manager
Specialization
Laravel development
Slide 5
Slide 5 text
VACATURE
FRONT-END DEVELOPER
Slide 6
Slide 6 text
OPEN SOURCE SOFTWARE
Slide 7
Slide 7 text
Open source software
± 90 packages on Packagist
± 1 800 000 downloads total, ±240 000 downloads a month
A lot of benefits: learning, forced to write documentation and
tests, showing the quality of our work, eating our own dogfood
Slide 8
Slide 8 text
https://spatie.be/opensource
Slide 9
Slide 9 text
http://github-awards.com/users?type=world&language=php
Open source software
Slide 10
Slide 10 text
OUR OFFICE
Slide 11
Slide 11 text
No content
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
No content
Slide 14
Slide 14 text
No content
Slide 15
Slide 15 text
No content
Slide 16
Slide 16 text
https://github.com/spatie/dashboard.spatie.be
Slide 17
Slide 17 text
No content
Slide 18
Slide 18 text
No content
Slide 19
Slide 19 text
No content
Slide 20
Slide 20 text
No content
Slide 21
Slide 21 text
No content
Slide 22
Slide 22 text
No content
Slide 23
Slide 23 text
No content
Slide 24
Slide 24 text
No content
Slide 25
Slide 25 text
No content
Slide 26
Slide 26 text
No content
Slide 27
Slide 27 text
HIGH LEVEL OVERVIEW
Slide 28
Slide 28 text
The dashboard is a single HTML page
Displayed by a full screen browser
Without full page reload
Each tile wil be updated by JavaScript
Each tile has it’s own update frequency
In short
Slide 29
Slide 29 text
Technology stack
Laravel Pusher Vue.js
Slide 30
Slide 30 text
Laravel 5.4
Render the initial page
Fetch data from external API’s (scheduled)
Broadcast events when new data has arrived
Laravel
Provides full-duplex communication channels over a single TCP
connection
Transporting events from server to the browser
In realtime
Secure
Paid service
Pusher
Slide 33
Slide 33 text
WebSockets
Transporting events from server to the browser
In realtime
Secure
Paid service
Pusher
Slide 34
Slide 34 text
Transporting events from server to the browser
In realtime
Secure
Paid service
Pusher
Magic
Slide 35
Slide 35 text
Lot of ♥ from the Laravel community
Easy to learn
Each tile is a component
Listen for incoming events
Update the tile
Vue 2
Vue.js
Slide 36
Slide 36 text
No content
Slide 37
Slide 37 text
DEMO
Slide 38
Slide 38 text
Grid system
The clock tile
The Packagist tile
The Twitter tile
Topics
Slide 39
Slide 39 text
There will be
some live coding
We’ll use
an internet connection
Slide 40
Slide 40 text
DISPLAYING ON A TV
Slide 41
Slide 41 text
Raspberry Pi 2
Slide 42
Slide 42 text
Raspberry Pi 2
Powered by the USB port from the TV
Uses Raspbian Jessie
Boots into Chromium 51 in fullscreen mode
Setup
Slide 43
Slide 43 text
TRY IT OUT YOURSELF
Slide 44
Slide 44 text
Source code
https://github.com/spatie/dashboard.spatie.be
Blog posts
https://murze.be/2016/06/building-dashboard-using-laravel-vue
https://murze.be/2016/06/grid-layout-dashboard/
Documentation
Slide 45
Slide 45 text
ROUND UP
Slide 46
Slide 46 text
Credits
Willem Van Bockstal
@willemvbockstal
Looks + grid system
Sebastian De Deyne
@sebdedeyne
Scrutinising + JS wizardry
https://www.geckoboard.com/
http://www.cyfe.com/
https://razorflow.com/
http://dashing.io/
Built by Shopify, Ruby. No longer maintained, but works great
Alternatives