Skip to content

jos3duardo/laravel-echo-chat

Repository files navigation

Simple chat using Laravel Echo and Pusher

Preview list rooms

room

preview chat

chat

About

This project creates a chat system, in the room list screen it is possible to create, edit and delete rooms. After creating a room it is possible to enter in the room and start a chat with users who are online and in that room. The system notifies you when a user enters the room. In the room you can view the conversation history, as well as chat.

The images of users are the site GRAVATAR

Start this application

First install package
composer

composer install

NPM

npm install

create a database sql and set your configuration in .env file

A Pusher account is required. Create account and set this information according to the parameters required of the file .env

.env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE='your database name'
DB_USERNAME='your user database'
DB_PASSWORD='your password database'

BROADCAST_DRIVER=pusher

PUSHER_APP_ID='your id'
PUSHER_APP_KEY='your key'
PUSHER_APP_SECRET='your secret'
PUSHER_APP_CLUSTER='your cluster'

Run database

php artisan migrate

or you can add data for testing using seeders with the command below. This command add 10 chat rooms and 11 users in your application

php artisan migrate --seed

start php server

php artisan serve

start node server mode watch

npm run development -- --watch

Set configs Laravel Echo

resources/js/bootstrap.js

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: 'yor key',
    cluster: 'mt1',
    forceTLS: true,
    encrypted: false
});

License

The project is open-source software licensed under the MIT license.