This project is an example how to use Websocket and OneSignal Push Notification in Laravel application. The websocket library use in this project is laravel-websocket and for the OneSignal library this project use laravel-notification-channel/onesignal.
-
Clone this repository with the command below
git clone https://github.com/wijaksanapanji/laravel-websocket-example.git
-
cd
into the project directorycd laravel-websocket-example
-
Copy
.env.example
to.env
-
Install the dependency of the project
composer install
npm install
-
Generate Laravel
APP_KEY
with this commandphp artisan key:generate
-
Fill
.env
file with yourONESIGNAL_APP_ID
andONESIGNAL_REST_API_KEY
-
if you want to change pusher enviroment variable, you need to change it in
.env
file andresources/js/bootstrap.js
-
migrate the database migration with
php artisan migrate:fresh --seed
-
then run the laravel project
php artisan serve
-
Also run the websocket server
php artisan websockets:serve
-
finally you can access the website one
http://localhost:8000
-
Admin
email: [email protected]
password: password
-
User 1
email: [email protected]
password: password
-
User 2
email: [email protected]
password: password