Examples

GraphQl SSE subscriptions Example

Check the example

Protocol

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

Configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const schema = `
schema {
query: Query
subscription: Subscription
}
type Query {
hello: String
}
type Subscription {
greetings: String
}
`
const greetings = introspect.graphql({
apiNamespace: 'sse',
url: 'http://127.0.0.1:4000/graphql/stream',
loadSchemaFromString: schema,
subscriptionsUseSSE: true,
})

Getting started

1
npm install && npm start

Check results

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

SSE output

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

Was this article helpful to you?
Provide feedback

Edit this page