I have a parent live view and a child component, and I am trying to establish a communication channel from parent to child as described in Communicating between LiveViews on the same page – The Pug Automatic, section Parent to child via send
. So, in the child’s mount I have:
if connected?(socket) do
send(socket.parent_pid, {:child_pid, self()})
However, I am getting an error message:
** (ArgumentError) argument error
:erlang.send(nil, {:child_pid, #PID<0.679.0>})
On inspection of the socket, it appears that the parent_pid is nil in the socket in this this component.
How is that possible?