# mix.ex
def project do
[
app: :client,
version: "0.1.0",
elixir: "~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end
...
defp deps do
[
{:phoenix, "~> 1.7.10"},
# {:phoenix_ecto, "~> 4.4"},
# {:ecto_sql, "~> 3.10"},
# {:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 3.3"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.20.1"},
...
{:cors_plug, "~> 3.0"}
]
end
# socket.ex
defmodule ClientWeb.PageSocket do
use ClientWeb, :live_view
...
Im using cors_plug to allow cross site access.
I have 2 instances of the same server running, 4000, 4010
For whatever reason Liveview mounts to both. When it mounts to 4010 which is the port the site is being served from, it mounts as %{private: %{connect_info: %Plug.Conn{}}} = socket
When it mounts to 4000 it does not.
I need access to the headers in 4000. Also I would like to know why it mounts to 4010 at all?
// app.js
let liveSocket = new LiveSocket(`ws://localhost:4000/live`, Socket, {
params: params,
hooks: Hooks
});