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

chore(example): Implement GraphQL Subscriptions with Yoga and WebSockets in BunJS #3043

Merged

Conversation

ashbuilds
Copy link
Contributor

@ashbuilds ashbuilds commented Oct 5, 2023

This PR provides an example of integrating GraphQL subscriptions using WebSockets in BunJS, leveraging makeHandler api provided by graphql-ws.
👉 #3041

@changeset-bot
Copy link

changeset-bot bot commented Oct 5, 2023

⚠️ No Changeset found

Latest commit: d8bcfa9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ashbuilds ashbuilds marked this pull request as ready for review October 5, 2023 20:41
function afterEach() {
server.stop();
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we test WS here?

}

it('shows GraphiQL', async () => {
beforeEach();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using the beforeEach and afterEach lifecycle hooks instead of manually calling setup and tear down functions ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I wrote this test, Bun didn't have those hooks :/ Not sure if it has now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loookig at the documentation, it should :-) I don't know when they added them

@EmrysMyrddin EmrysMyrddin merged commit 38b2c21 into dotansimha:main May 17, 2024
Copy link
Contributor

✅ Benchmark Results

     ✓ no_errors{mode:graphql}
     ✓ expected_result{mode:graphql}
     ✓ no_errors{mode:graphql-jit}
     ✓ expected_result{mode:graphql-jit}
     ✓ no_errors{mode:graphql-response-cache}
     ✓ expected_result{mode:graphql-response-cache}
     ✓ no_errors{mode:graphql-no-parse-validate-cache}
     ✓ expected_result{mode:graphql-no-parse-validate-cache}

     checks.......................................: 100.00% ✓ 390848      ✗ 0     
     data_received................................: 1.6 GB  13 MB/s
     data_sent....................................: 79 MB   657 kB/s
     http_req_blocked.............................: avg=1.55µs   min=952ns    med=1.34µs   max=5.82ms   p(90)=2µs      p(95)=2.22µs  
     http_req_connecting..........................: avg=2ns      min=0s       med=0s       max=144.75µs p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=397.42µs min=219.2µs  med=352.8µs  max=24.54ms  p(90)=552.69µs p(95)=575.05µs
       { expected_response:true }.................: avg=397.42µs min=219.2µs  med=352.8µs  max=24.54ms  p(90)=552.69µs p(95)=575.05µs
     ✓ { mode:graphql-jit }.......................: avg=299.39µs min=219.2µs  med=277.82µs max=18.46ms  p(90)=310.41µs p(95)=323.79µs
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=581.96µs min=481.86µs med=551.51µs max=10.38ms  p(90)=599.74µs p(95)=637.21µs
     ✓ { mode:graphql-response-cache }............: avg=377.49µs min=294.1µs  med=357.15µs max=16.31ms  p(90)=390.72µs p(95)=403.09µs
     ✓ { mode:graphql }...........................: avg=394.33µs min=302.07µs med=360.1µs  max=24.54ms  p(90)=410.41µs p(95)=457.76µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 195424
     http_req_receiving...........................: avg=34.3µs   min=17.58µs  med=33.95µs  max=810.98µs p(90)=40.72µs  p(95)=44.42µs 
     http_req_sending.............................: avg=8.57µs   min=6.03µs   med=7.51µs   max=652.54µs p(90)=11.17µs  p(95)=12.56µs 
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=354.54µs min=190.45µs med=310.54µs max=24.4ms   p(90)=509.17µs p(95)=529.64µs
     http_reqs....................................: 195424  1628.511231/s
     iteration_duration...........................: avg=609.17µs min=403.2µs  med=560.87µs max=25.24ms  p(90)=768.21µs p(95)=794.56µs
     iterations...................................: 195424  1628.511231/s
     vus..........................................: 1       min=1         max=1   
     vus_max......................................: 2       min=2         max=2   

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.

4 participants