-
-
Notifications
You must be signed in to change notification settings - Fork 174
✨ feat: add crossws adapter #630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Great stuff, thanks! Please make sure to also add it to the test servers so that the full server test suite can make sure it works as expected. |
Hey, I'm trying to wrap around how the tests work and have two questions:
I'd be very thankful for your input on this! |
Thank you for your work on this! |
Ok, thanks! I tested a lot locally and with various example projects and it works pretty nice like this. Unfortunately I did not fully understand the test setup yet so I'll have to look into that when I find the time. |
Thanks! The server testing suite is not all that complicated, you have to:
Having the tests is a necessity for merging this PR. No hurry though, whenever you get time. P.S. there are other failing checks, please see the CI |
Hey, thanks for your fast response times, really helps me out/lets me stay motivated. Probably also not beneficial to do this after a full 8h work day all the time so please excuse all those questions.
I know this isn't 'really' testing the specifics of the crossws adapter but since these are integration tests anyway and crossws isn't a real adapter for a runtime on its own but more of a glue between the two systems this might suffice your requirements. Let me hear what you think! Regarding the failed tests: These refer to this part of the spec, right? I'm not tooo into WS and graphql-transport-ws so I'm wondering if this a specific graphql-transport-ws or a general WS thing. I'm asking because the deno and bun client do not have explicit logic on this, it seems to me like the clients do that automatically? Would the crossws adapter be the right place to implement a ping logic and what if the client already does(like bun?), should the adapter check that and prevent double pings in these cases? |
Hey, did you by any chance have the time to take a look or some feedback on this? |
(crossws maintainer here) LMK if could do any help on this ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than this one remark, this looks good to me.
Please create a changeset using yarn changeset
in order to preare a release.
I'll also have to check why's the CI not running here. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from adding the example in the changelog, it'd be a good idea to add it to the get started documentation too to advertise the support.
In the get-started.mdx, add a new entry under "Start the server" called "With crossws".
Oh and don't forget to run |
Co-authored-by: Denis Badurina <[email protected]>
Please fix the formatting, run Regarding the failing tests and your comment, those tests are important and should not be ignored. Those keep-alive pings and pongs are not from the GraphQL over WS spec, but are from the WebSocket spec itself. You can advise the Lines 108 to 131 in 5161bd9
Disclaimer, I don't fully understand crossws and how/whether this can be implemented in crossws, maybe @pi0 can help? What are your thoughts here? How do you see handling keepalive? |
Escalated to h3js/crossws#154 for keep alive support |
Great work @m1212e! Thank you! |
Adds an adapter for crossws.
I know this has been discussed in #546 but with SvelteKit on the way of implementing native WS support via crossws I thought this might be useful nonetheless. We need to wait for h3js/crossws#149 before proceeding with this.