Skip to content

clevyr/docker-laravel-echo-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-laravel-echo-server

Node Docker container with tlaverdure/laravel-echo-server installed. All of the laravel-echo-server environment variables are usable.

Installation

  1. Add this container to your docker-compose.yml with the following service definition.
echo-server:
  image: ghcr.io/clevyr/laravel-echo-server
  restart: unless-stopped
  1. If you are using clevyr/docker-caddy, configure the /socket.io route by adding the following env to the proxy service.
proxy:
  image: ghcr.io/clevyr/caddy
  environment:
    SOCKETIO_ADDRESS: echo-server:6001
  1. Install the client libraries
npm install laravel-echo socket.io-client
  1. Add the following snippet to resources/js/bootstrap.js.
import Echo from 'laravel-echo';

window.io = require('socket.io-client');

window.Echo = new Echo({
  broadcaster: 'socket.io',
  host: window.location.hostname,
});
  1. Follow the Laravel Broadcasting documentation to set up and subscribe to a channel.

Environment Variables

Refer to the DotEnv section of tlaverdure/laravel-echo-server for an environment variable listing.