What is the best way to share state between phoenix channels?

@ibarch: Did you read my question?
What I done in one project is separate user actions (login, register, logout …) and other logic. I generated Token for user.id and send it to client. Then client sends when connecting to other channels and finally server-side in join method I verified token and searched for user with id from result and assigned it to channel.
To keep session I saved token in cookies and send it to users channel also when joining, so all join methods have call to module to verify, find, fetch user data and assign them to channel.

1 Like