Comments (5)
Good idea! We should offer a handler like that.
However, onOperation
is a better suited name for when an operation resolves, and onSubscribe
for immediately when the user requests a subscription (operation execution).
The current onSubscribe
has to change. Even if its a breaking change, its worthwhile! Check #40 out.
from graphql-ws.
Currently you'd have a hard time setting up persisted queries because AST parsing is run on the subscribe payload query before the onSubscribe
.
I will lift this limitation and then you should be able to request something like this:
{
"id": "unique-transport-id",
"type": "subscribe",
"payload": {
"query": "persisted-query-id",
"variables": { "hey": "there" }
}
}
Find the persisted query in onSubscribe
, supplement it, validate and then execute.
from graphql-ws.
Could we implement a handler that is run before that e.g. onOperation?
from graphql-ws.
🎉 This issue has been resolved in version 1.9.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from graphql-ws.
Quick heads up, @n1ru4l, [email protected]
just landed, adding the extensions
field in the subscribe message payload.
This means that you now can pass along the persistedQuery
through that field on each subscribe as various other libraries/frameworks suggest. And of course, extend with your custom requirements. 😄
from graphql-ws.
Related Issues (20)
- graphql-yoga integration example breaks for mutations HOT 2
- JWT Expired gives fatal error. How to refresh the JWT token for an open GraphQL subscription? HOT 4
- Refresh JWT Token in connection init
- Malformed authorization headers on [email protected] only on iOS HOT 4
- Socket could not reconnect after IOS app comeback from background
- wrong protocol in connection
- Detecting when a websocket connection is down
- [ReactNative] Slow refresh subscription causes websocket close with {"isTrusted": false, "message": null} HOT 18
- Retry on different URL HOT 1
- Hasura connection error is not reported correctly
- Server race condition: connection ack + first subscribe HOT 6
- Allow to update connectionParams
- fix incorrect Bad Gateway error code HOT 3
- Subscriptions not working with Hasura via apollo Client graphql. error - Error: WebSocket implementation missing; HOT 1
- rename onMessage in server to postMessage, withMessage (or something more appropriate) HOT 1
- How to use `graphql-ws` protocol?
- Websocket using bun server - Unable to access request object in ctx.extras
- Warning Workspaces can only be enabled in private projects. HOT 3
- Detect subscription successfully started
- Errors during streaming subscriptions aren't properly handled or emitted HOT 1
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 graphql-ws.