Comments (7)
Sure, a recommendation sounds good. But please make it 4403: Forbidden
instead because that is what the library uses if you return false in the onConnect
hook:
Line 614 in 972ed07
from graphql-ws.
Simply closing the websocket is not ideal, since that is a separate protocol layer.
Why not? This is the reason why there is no positive rejection. You have an abundance of user-land close codes (4000-4999) that can be accompanied with any 123 character reason.
Furthermore, you can close the connection at any time (even after acknowledging the connection, or before even considering the connection) and it is very convenient to do so within graphql-ws
hooks.
We could specify that the standard way is to close the websocket with some specific error code.
The standard is to close the connection with a close event. GraphQL over WebSocket is a subprotocol under WebSockets, meaning - the conventions of WebSockets are recommended and implied. The spec should be kept as light as possible, it should aim to standardise the GraphQL relevant transport with enough constraints but very small overhead.
from graphql-ws.
Okay, still user-land error codes are always ambiguous. When writing an implementation conforming to a protocol and expecting good interoperability, it is great to have rules and recommendations and as little ambiguity as possible. The protocol already defines a few 4xxx codes to use.
Could we agree on a websocket close code in this case? Would you accept a PR where this recommendation on how to reject a connection_init
request is made explicit? Maybe the 4401: Unauthorized
message?
from graphql-ws.
🎉 This issue has been resolved in version 5.12.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from graphql-ws.
My bad, I referenced the wrong issue when merging #456.
from graphql-ws.
Ok, created a PR. There is code out there written in different programming languages which is trying to follow the spec, and not necessarily reverse engineering the .ts source :)
from graphql-ws.
🎉 This issue has been resolved in version 5.12.1 🎉
The release is available on:
Your semantic-release bot 📦🚀
from graphql-ws.
Related Issues (20)
- 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
- fastify websockets breaking change HOT 4
- ERROR CREATING WsLink
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.