I have put this repo together so that others can get started easily with Laravel and Vue.js and Socket.io
- Clone the repo
- Add a .env file and add your database credentials (an example below if you're using Homestead)
DB_HOST=192.168.10.10
DB_DATABASE=fiveone-vuejs-socketio
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=redis
- Run composer install/update
- Run
npm install
(might need to usesudo npm install
) - Migrate your database
php artisan migrate
- Run
gulp
to compile the resources/assets into your public/ directories - Open up two tabs within the command line and SSH into Homestead
- Go to your project root and in the first one run
redis server --port 3001
- In the second run
node socket.io
- I think you should be ready to test in the browser
- /guestbook to sign the guestbook (Vue.js)
- /fire and /test to, well, fire and event and test that you can see it. (All the while you can see the output in the command line)
- Integrate Vue.js and Socket.io so notifications are sent to logged in users when there is a new post.
- Install supervisord or similer to keep socket alive.