Trying to learn Channels for about the 8th time in a year and have yet again reached the point where I want to give up.
Is it possible to pass values directly from my liveview socket to my phoenix socket? Seems like it should be possible but I have no idea how its meant to be done. Every guide I’ve seen just seems to use JS and get values from stuff like the path.
Yes, very much so! The key step to establishing communication from the LiveView socket to a custom channel socket is using something like Registry to keep track of the Channel process id (pid) for a given LiveView session.
@SophieDeBenedetto wrote an excellent walk through guide on Using Channels with LiveView for Better UX with some high level workflow diagrams. Just a note, the code examples will likely need to be tweaked and adapted depending on your version of Phoenix/LiveView and the generators used to create your app.
Interesting thank you, I shall give it a read and see if it works.