michaelcaterisano
I’m trying to find a way to conditionally send a subscription event. For example, if a subscription operation is sent from the same session as the mutation operation that triggered it, I want to avoid sending an event to the client, because they will have already received the mutation payload.
I found that if I return {:ok, :any_atom} from a subscription field resolver, no event is sent. If I send {:ok, nil}, an event is sent with nil as the payload.
The former is what I want and seems to work, but I’m not sure why it works. Could you shed some light on the Absinthe mechanics here? And if there’s a better way to handle this, I’d love to know.
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
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
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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
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
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
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
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
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
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
That does seem weird, are you sure it isn’t just causing a crash and then that’s why it isn’t publishing?
As far as your goal goes, how are you determining that it is the same session? What is your plan if the same user has multiple browser tabs open? I’m not entirely sure this is a desirable optimization.
michaelcaterisano
I don’t disagree that it’s a bit weird, but it’s a product request so, you know.
The session id is generated client-side on a per-window/tab basis. It gets attached to the Graphql context, and also to mutation payloads. The subscription resolver compares the id on the context and the mutation payload.
I was hoping I could return an {:ok, :ignore} tuple and intercept that result somewhere at the phoenix channel level, swallowing the message there. Any thoughts on how I might be able to plug into Absinthe’s channel layer?
michaelcaterisano
@benwilson512 This is what I came up with. Do you have any suggestions about other ways I might be able to handle this?
michaelcaterisano
@benwilson512 It doesn’t seem to be crashing. If I raise in the subscription resolver, my test process doesn’t crash. I confirmed that they’re the same process.
The middleware approach does raise though with:
[error] no function clause matching in Absinthe.Middleware.Telemetry.on_complete/2.It seems like Absinthe is rescuing exceptions at a high level and not crashing; does that sound right to you?