Comments (6)
Hey there! Quick update, I feel like both problems can be solved with enisdenjo/graphql-ws#117 (comment). 😄
from subscriptionless.
Thanks for taking the time to look at this @enisdenjo 🔥
Your suggestion of adding client->server ping/pong on the GraphQL layer is a good shout! Any interval-based messaging should work around the naive idleness detection but, if it needs to be done, that's probably one of the better ways!
I'll keep this open for now as there's still no resolution for server->client ping/pong.
I suspect the solution for this needs to be baked into AWS because, lets say server->client ping/pong does get baked into the graphql-ws subprotocol, we'd still need to:
- At runtime, create CloudWatch rules to trigger ping messages to a connection at a given interval
- At runtime, create a CloudWatch rule to teardown the connection after a given duration
- Delete the teardown CloudWatch rule when a pong is received on a connection
The problem of server side idleness detection has already been solved in the WebSocket spec through control frames so I'm unsure why AWS's API Gateway implementation is using data frames to detect idleness.
Other than the feature request above, I know @dabit3 has hit up some of the folks working on serverless at AWS - so fingers crossed we can shine some light on this 💡
from subscriptionless.
Heads up enisdenjo/graphql-ws#201. As of [email protected]
, subprotocol ping and pong messages are supported.
from subscriptionless.
I doubt we can make a change there. It has been like this since the beginning. All major browsers have these limitations and bug reports open since forever (you can Google to find them), no progress there. The arguments are straight forwards: not deemed necessary, preserve battery, the OS/browser should detect idleness; and most importantly, you can design your keep-alives on the subprotocol level.
Additionally, cited from enisdenjo/graphql-ws#117 (comment):
Seems like that the general tenor of browser implementors is to not touch the WebSocket API anymore and instead push WebTransport forward (which is probably 1-2 years away from broad adoption):
from subscriptionless.
Thanks for the heads up @enisdenjo!
Gutted to see where having to add support for this on the sub-protocol layer (via data frames) when the lower level WS protocol itself (via control frames) is supposed to be responsible for "communicat[ing] state about the WebSocket".
I wonder if there's a way we can provide feedback to teams working on the lower level protocols (or more likely clients) to prevent other sub-protocols from having to do this work too. This works around some issues but I don't think a GraphQL specific sub-protocol should have ever had to consider "transport layer" logic.
From what I can tell, some of the issues that have led to this becoming necessary are:
- No support in browser JS runtime for identifying or dispatching control frames (for client->server ping/pong)
- API Gateway WS implementation using data frames to evaluate the state of the websocket (this issue)
- Other things?
Anywhoo - thanks so much for adding support for this while we work within the current constraints. I'll look into getting full support for the new protocol additions soon so that this can (hopefully) be something I can actually recommend to folks for production usage.
from subscriptionless.
Quick update for anyone keeping tabs on this issue.
I've spent a few hours today working on getting graphql-ws v5 support sorted. The easy stuff such as responding to ping messages is sorted.
After some research, it looks like a state machine is the way to go for scheduling ping dispatch and ping timeout logic. Assuming this isn't a limitation in AWS itself, the main roadblock is a lack of support for step function websocket event invocation in serverless-step-functions. Subscriptionless works just fine without serverless framework, but its the easiest route for most people getting started.
from subscriptionless.
Related Issues (18)
- Add batching by topic for published events
- Optimize execution of user event handlers
- Subscription Input HOT 3
- Add clean exit for expected state machine states
- Add ability to customize payload in connection_ack
- Mutation and Query Support HOT 12
- Context connectionId HOT 2
- Sockets closed by the server don't contain a "Close Code" or "Close Reason"
- Add support for @defer and @stream directives
- Use alongside Apollo Server HOT 2
- Allow custom domain mappings HOT 9
- Add CloudFlare support HOT 1
- withFilter example & typings HOT 2
- One or more parameter values were invalid: Condition parameter type does not match schema type HOT 3
- Add TTL for subscriptions
- Add storage adapters HOT 4
- Add sendMessage handler HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subscriptionless.