LARAVELReactive Development
Jasper Staats Full-Stack Developer
REACTIVE
WEBSOCKETS
DATA-FLOW
EVENTS IN LARAVEL
Maak het event aan via Artisan
Resultaat
App\Providers\AppServiceProvider
App\User
ECHO
OUDE METHODEServer Node.js
NIEUWE METHODE
IMPLEMENTATIEVereisten
- Mac- Composer- Node.js ( NPM )- Redis lokaal geïnstalleerd ( Mac = brew install redis )- Laravel 5.4 - PHP 7
IMPLEMENTATIE
WIJZIGINGEN
WIJZIGINGEN (2)Authenticatie voor private-channels (routes/channels.php)
laravel-echo-server start
UE.JSviews\app.blade.php
resources/js/bootstrap.js resources/js/app.js
RESULTAAT
CHANNELS
PUBLICPRIVATE
PRESENCE
PUBLICEveryone can subscribe and can see this information
Mostly general announcements.No direct authentication from back and front-end
PRIVATEmeaning the frontend has to authenticate the user against a backend
and then assure that the user has permissions to subscribe to the given channel
PRESENCEwhich doesn't allow for sending messages and instead just
notifies that a user is "present" in the channel or not.
API
WATERMELONDEMO
SOCKET.IO MOGELIJKHEDEN
VRAGEN?