luzaranza
Phoenix Presence.update plays well with intercepted handle_out "presence_diff"?
Hi all.
Sorry for bringing your attention to this topic - I’m sure it’s been touched on before, but here goes … In my JavaScript Phoenix client, I’m running React hooks, and there is a component -a “Game Room Channel” context provider function- which talks to a Phoenix channel counterpart, which in turn has a Presence.track function and an intercepted handle_out “presence_diff” callback (On the client, there is a useEffect hook that sets up Presence.onJoin and Presence.onLeave listeners. Everything appeared to be going fine until I added a Presence.update function to the Phoenix channel, this in order to update a status field in the metadata. Now, the client is reporting what appears to be a “leave/join episode from another device” in the metas, although the new device appears to be identical with the current one. Checking the presences map on the server shows a pair of leave/joins for the same sub-key within each leaves/joins key respectively, (in the first metas list element, there is a phx_ref under the leaves sub-key that matches the phx_ref_prev under the joins key). I’ve been able to suppress these spurious leave/joins on the client, but I was wondering if this is normal Phoenix Presence behaviour, or if I’ve done something wrong?
First Post!
axelson
Can you explain more (and preferably show some code) for what you added here, as well as exactly what you were trying to accomplish?
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









