Client-server communication setup via REST and WebSockets
In production, or when your client-server app is running in a Docker container, the server port is typically configured outside of your control. So how can the client still discover the server's port dynamically in order to access REST resources or setup a WebSocket connection? The approach taken here is too serve the client as a static resource via the server, use `document.location.href` to infer the location of the server, and fallback to the hard-coded development settings if that fails.
Tags: rest, websockets, docker, node