Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.39 KB

README.md

File metadata and controls

51 lines (34 loc) · 1.39 KB

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.