skokon
How i can get socket data by the data i assigned to it
Hello Elixir community, I’m new to elixir and phoenix, I’m trying to get the socket by the data I already assigned to it
for example, I’ve set the user-id
socket = assign(socket, :user_id, USER_ID)
Now I want to get the socket using user_id I already have
Most Liked
sfusato
In the template rendered by render you can access it directly like this: @user_id. In the other callbacks (handle_params, handle_event, handle_info) or other functions where you pass the socket, it will be under the :assigns key, so in this case: socket.assigns.user_id.
skokon
Hello, thanks for the reply, I know how to access the assigns key, actually what I want is to access the socket from the user_id, what I want to do is I call a function and pass player id and returns all assigned keys by the player id, I hope u understood what I mean







