Skip to content

Latest commit

 

History

History

graphql-sse-subscriptions

WunderGraph subscriptions example - SSE

Protocol

https://github.com/enisdenjo/graphql-sse/blob/master/PROTOCOL.md

Configuration

const schema = `
schema {
  query: Query
  subscription: Subscription
}

type Query {
  hello: String
}

type Subscription {
  greetings: String
}
`;

const greetings = introspect.graphql({
  apiNamespace: 'sse',
  url: 'http://localhost:4000/graphql/stream',
  loadSchemaFromString: schema,
  subscriptionsUseSSE: true,
});

Getting started

npm install && npm start

Check results

curl -N http://localhost:9991/operations/Sse

SSE output

 curl -N 'http://localhost:9991/operations/Sse?wg_sse=true'

Learn More

Read the Docs.

Deploy to WunderGraph Cloud

Deploy to WunderGraph

Got Questions?

Join us on Discord!