nuxt-graphql-server icon indicating copy to clipboard operation
nuxt-graphql-server copied to clipboard

Using Subscription

Open maimaiyeuem12009 opened this issue 3 years ago • 3 comments

Hello, I tried to used graphql-ws with apollo server follow https://www.apollographql.com/docs/apollo-server/data/subscriptions but I could not get it working. I have try to pass both express and h3 server to createServer but still get the error: not support grahql-ws can you help me ?

maimaiyeuem12009 avatar Nov 18 '22 10:11 maimaiyeuem12009

Websockets are currently not yet supported by h3/nuxt. There are a few workarounds (relatively easy for dev server, pretty hacky for production). I've raised https://github.com/unjs/nitro/issues/678 to discuss proper ws support with nuxt.

Maybe relevant: https://github.com/nuxt/nuxt/pull/19230

tobiasdiez avatar Nov 20 '22 16:11 tobiasdiez

Is it still blocked or resolved? h3 supports ws tho

wokalek avatar Mar 16 '24 19:03 wokalek

@wokalek Thanks for the pointer. Indeed, h3 now supports ws via crossws and it was pretty straightforward to implement graphql-ws support on top it. For me, it's working great so far, and I will include it in the apollo-server h3-integration package: https://github.com/apollo-server-integrations/apollo-server-integration-h3/pull/65. Would be awesome if you could give it a try and report back if you encounter any errors.

tobiasdiez avatar Mar 23 '24 11:03 tobiasdiez