Skip to content
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

Add GraphQLWs subscription transport option for GraphiQL #1162

Merged
merged 4 commits into from
Nov 11, 2024
Merged

Conversation

Shane32
Copy link
Member

@Shane32 Shane32 commented Oct 31, 2024

This feature is necessary in case the user has disabled the subscription-transport-ws package/protocol, which is desirable if you need 'secure' keep-alive packet functionality.

@Shane32 Shane32 self-assigned this Oct 31, 2024
@Shane32 Shane32 requested a review from gao-artur October 31, 2024 04:37
@Shane32
Copy link
Member Author

Shane32 commented Oct 31, 2024

@gao-artur What do you think? It currently loads both protocol implementations but only initializes the one its configured to use. I could make it only load the one it needs, but at that point maybe two different cshtml files would be better -- but that's more maintenance, and I'd prefer to just have a single cshtml file to manage. I found the js code somewhere, changed it quite a bit, modified it so that non-subscription requests will use the regular fetcher (which supports headers) and stuff. Everything seems to work like it should -- (actually it works better than before, since now the stop button works to unsubscribe).

@gao-artur
Copy link
Contributor

I'm sorry, but I'm a 100% C# backend rat, and I have zero knowledge of frontend and JS (I've been trying to avoid touching them my whole career).

@STRATZ-Ken
Copy link

STRATZ-Ken commented Nov 11, 2024

Wanted to chime in here. I believe the ultimate issue for us was with the older technology this is what would happen. We send fairly large web socket messages. When people are on their phone then go to another website/close, the phone would leave an idle connection for some time. However we would continue to send packets over and over filling a buffer that could never be released.

This code above would allow us to make sure that the buffer is kept small/clean or force a disconnect. This is pretty common on newer phones to keep a semi-connection incase the user comes right back.

@Shane32 Shane32 merged commit a3e52a0 into master Nov 11, 2024
7 checks passed
@Shane32 Shane32 deleted the graphiqlws branch November 11, 2024 21:05
@Shane32 Shane32 added this to the 8.2.0 milestone Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GraphiQL: Update subscriptions to support the newer graphql-transport-ws sub-protocol
3 participants