I want to add a few data into socket but wondering what the best way to do that would be.
Instead of doing a bunch of
socket = assign(socket, :channel_id, channel_id)
There is an alternative function assign/2 that allows assigning multiple values at once, by passing either map or keyword list:
assign(socket, name: "Elixir", logo: "💧")
assign(socket, %{name: "Elixir"})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With