sohelamin / laravel-event-broadcast

Laravel event broadcasting with Node.js, Redis & Socket.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Event Broadcasting Example

Laravel event broadcasting with Node.js, Redis & Socket.io

Requirements

Node.js
Redis
Socket.io

Installation

  1. Clone the the repository

    git clone https://github.com/sohelamin/laravel-event-broadcast.git
    
  2. Navigate to your project directory and run

    composer install
    npm install
    php -r "file_exists('.env') || copy('.env.example', '.env');"
    php artisan key:generate
    

Usage

  1. Start your project

    php artisan serve
    
  2. Run socket.io using node

    node socket.js
    
  3. Broadcast your event via http://localhost:8000/broadcast & listen via http://localhost:8000/listen

Via Docker

  1. Start the docker's containers

    docker-compose up -d
    
  2. Migrate tables & Listen the queues

    docker exec -it laraveleventbroadcast_app_1 bash
    cd /var/www
    php artisan migrate
    php artisan queue:listen
    
  3. Run node

    docker exec -it laraveleventbroadcast_app_1 bash
    cd /var/www
    node socket.js
    
  4. Broadcast your event via http://localhost/broadcast & listen via http://localhost/listen

##Author

Sohel Amin

About

Laravel event broadcasting with Node.js, Redis & Socket.io


Languages

Language:CSS 59.9%Language:PHP 30.9%Language:HTML 8.1%Language:JavaScript 0.7%Language:Vue 0.2%Language:ApacheConf 0.2%