Hey guys,
I am learning Elixir, (As of now learning how messaging between processes work).
I tried to do a back and forth messaging between LiveBook and iex session.
So I created an iex session using command:
iex --sname derpycoder --cookie wubalubadubdub
Then after connecting to the named iex node, from LiveBook, I ran: self()
.
I got some pid, #PID<0.153.0>
, which I then passed into pid(0, 153, 0)
function in iex terminal to get the pid of LiveBook.
pid = pid(0, 153, 0)
send(pid, {:hola, "Hola LiveBook"})
And on the LiveBook side, I wrote:
Process.info(self(), :messages)
# OR
receive do {:hola, message} -> message end
But I am unable to do the same in LiveBook. i.e. Take the pid from iex and send message to it from LiveBook.
For that I need pid/3
function to convert the string representation of pid to actual pid.
Also flush
is missing in LiveBook.