I have googled the heck out of this and have come up mostly empty. Here's the ultra-compact explanation of what I'm trying to do:
I have 3 separate local environment instances (one for each developer), 1 stage environment, and 1 production environment. Each instance has its own unique domain name. Each one needs to run Echo through Socket.io / Laravel Echo Server on its own domain. This means that I need a unique 'host' value for each environment in /resources/js/bootstrap.js. I can not make this work with Elixir.
Here is a list of "solutions" that I have dug into:
(1) Use the 'dotenv' node package to pull in .env values. This package requires use of 'fs' which seemingly (depending on in whom you believe) can not be used in this manner with Webpack. Even if I could get it to work, this would mean adding the following to my deployment process:
rm node_modules -rf
npm install
gulp --production
That's fine, I guess, but it dramatically increases downtime in between php artisan down and php artisan up.
But again, I couldn't get dotenv to even read my .env file, and my attempts to use 'fs' to inspect the path were met with Webpack errors (see google for various solutions regarding node: { fs: 'empty' } and target: 'node' that resulted in zero progress, just different errors).
(2) Attempt to get everything to work through 'localhost' requests, so that I don't need to worry about the actual domain name.
This works until the first poll from JavaScript, which, of course, comes from the browser and winds up hitting your own computer instead of the server.
This is obvious and requires no explanation or help. I just wanted to include in case the thought crosses anyone's mind as a potential solution.
So I guess what I'm asking is... How are people managing this type of environmental set up for Echo / Socket.io / Echo Server?