skokon
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
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex











Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
sfusato
In the template rendered by
renderyou 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:assignskey, 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
sfusato
I’m not aware of anything built-in that will return all the sockets that have a specific assign in it. You could wire this with
PubSubwhere each liveview would subscribe and when called upon would respond.What are you trying to achieve?
skokon
I have a function and I called it get_status I will call it from the client and pass playerID parameter, what I want to get everything assigned to that socket with that playerID, I have some data I’ve set like channel id and player name and i want to retrieve that data using the player ID
rogerweb
Hi @skokon , I have the same need as you, i.e., given a socket’s id (as defined by the
id/1function), I want to get the socket struct. Did you figure out how to do it?