Comments (8)
@enisdenjo I would be willing to work on this improvement if you would like.
from graphql-ws.
A recipe would be a way, however... I spoke too soon.
@rpastro has actually a great point! I changed my mind, this would be indeed nice to have. Am already cooking up some code for this - bare with me. 😄
from graphql-ws.
Another enhancement I would like to suggest is to accept connectionParams to be a Promise or async function. I can open a separate enhancement request for this if you agree.
I agree! Please open another issue just for the sake of clarity and documentation.
from graphql-ws.
I think this is an unnecessary complexity. Exactly because of the overhead, we allow setting lazy
to false
to persist the connection. 😄
If you want even the fine grained control you're suggesting - I would actually prefer building one on top of the library. Where you recycle the client (client.dispose
+ client = createClient
) however you find comfortable.
from graphql-ws.
what about a Recipe for this?
from graphql-ws.
There are two problems with setting lazy to false.
The first one is that the client tries to create the WS before our application has obtained the security token which is required for the ConnectionInit message.
The second issue is that the goal is not to create a WS that stays open the entire time. The goal is to avoid closing & immediately reopening the socket within a few milliseconds. I still want to close the WS if there is no new activity after a certain amount of time.
from graphql-ws.
The first one is that the client tries to create the WS before our application has obtained the security token which is required for the ConnectionInit message.
Regarding this. Another enhancement I would like to suggest is to accept connectionParams
to be a Promise or async function. I can open a separate enhancement request for this if you agree.
from graphql-ws.
🎉 This issue has been resolved in version 1.13.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from graphql-ws.
Related Issues (20)
- 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
- httpOnly cookie authentication
- Promises getting rejected with non-Error objects HOT 2
- Some subscriptions remain open after a websocket has been closed HOT 2
- Getting "Internal error occurred during message handling. Please check your implementation." after following recipe
- Clarify Contribution Policy
- Clients can be sent an `Error` message after cancellation. HOT 2
- How to avoid logging of hole object in graphql-ws?
- Consider migrating to crossws
- Make code and reason optional when closing a connection HOT 2
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.