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
Last Post!
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









