enisdenjo / graphql-sse

Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client.
https://the-guild.dev/graphql/sse
MIT License
384 stars 19 forks source link

How to add parameters to With EventSource #74

Closed zahrat closed 1 year ago

zahrat commented 1 year ago

Discussed in https://github.com/enisdenjo/graphql-sse/discussions/73

Originally posted by **zahrat** August 6, 2023 I want to use graphql-sse in client-side ( with react-native). I read this [link](https://the-guild.dev/graphql/sse/recipes) but How to pass parameters to query? for example for subscription I have to pass userId , it's something like this: ` subscription ($userId: Int!) { notificationAdded(userId: $userId) { text isReaded notificationType senderId id } }` how to do that? I try this but its not working: `const url = new URL( api_url, ); url.searchParams.append( 'query', notificationAddedSubscription ); url.searchParams.append('variables', JSON.stringify({userId: 5}));`
enisdenjo commented 1 year ago

Discussion continued in #73.