Ashwin Mohan Ram

Team Lead, Implementations

Assistant Front Office Manager

IT Manager

Full-stack Laravel Vue Developer

Ashwin Mohan Ram

Team Lead, Implementations

Assistant Front Office Manager

IT Manager

Full-stack Laravel Vue Developer

Blog Post

Laravel-Echo-Server installation on Forge with SSL Enabled with the Redis broadcast driver and

September 20, 2017 Web Development

Install echo server globally through npm install -g laravel-echo-server

Navigate to project root then run laravel-echo-server init

Do you want to run this server in development mode? No

Which port would you like to serve from? 6001

Which database would you like to use to store presence channel members? redis

Enter the host of your Laravel authentication server.

Will you be serving on http or https? https

Enter the path to your SSL cert file. /etc/nginx/ssl/

Enter the path to your SSL key file. /etc/nginx/ssl/

(You can get these from Forge by navigating to your Site and selecting Edit Files > Edit Nginx Configuration)

Do you want to generate a client ID/Key for HTTP API? Yes

Take note of the Client ID and Key that is displayed. If not, you can always reference them in the laravel-echo-server.json

Now open up laravel-echo-server.json in the project root, and change the redis databaseConfig to the following:

    "redis": {
        "port": "6379",
        "host": “”
    "sqlite": {}

Now update your .env with the Client ID and Key


Remember to run php artisan config:cache if you have cached configuration that needs to be reloaded.

You will now need to update resources/assets/js/bootstrap.js as follows. Take note of the namespace parameter, which will affect the socket listens for Laravel Events.

    window.Echo = new Echo({
        namespace: ‘App\\Events',
        broadcaster: '’,
        host: ''

Now you can update your view to include the following. I placed it in the HTML head:

    <script src=""></script>

We now need to open the ports to allow and redis to work. In Forge under Server Details click on Network.

I used the following settings here: Name: SOCKETIO Port: 6001

Name: REDIS Port: 6379

I left the from IP field blank in both cases because I am not sure how to restrict the IP to just the localhost. I tried but it didn’t work.

Test the echo server by running laravel-echo-server start from the project root.

You should now see

 Starting server...

✔  Running at localhost on port 6001
✔  Channels are ready.
✔  Listening for http events...
✔  Listening for redis events...

Server ready!

It is important that the http events and redis events are ticked. Now stop the laravel-echo-server.

The final step that remains is to start up laravel-echo-server as a daemon process. This will ensure that Supervisor will keep the process running at all times. In Forge under Server Details now click on Daemons.

Use the following settings here:

Command: /usr/bin/laravel-echo-server start

User: forge

Directory: /home/forge/

Everything else you need to know is included in Taylor’s Laracasts on Echo 🙂

Good luck!

Write a comment