2.5.3 (2024-03-27)
2.5.2 (2023-12-20)
- remove package.json workspaces entry in release (c6dc093)
2.5.1 (2023-12-14)
2.5.0 (2023-12-13)
2.4.1 (2023-12-13)
2.4.0 (2023-11-29)
- client: Use closures instead of bindings (with
this
) (8ecdf3c)
2.3.0 (2023-09-07)
2.2.3 (2023-08-23)
- use/http,use/http2,use/express,use/fastify: Check
writable
instead ofclosed
before writing to response (3c71f69), closes #69
2.2.2 (2023-08-22)
- use/http,use/http2,use/express,use/fastify: Handle cases where response's
close
event is late (#75) (4457cba), closes #69
2.2.1 (2023-07-31)
2.2.0 (2023-06-22)
2.1.4 (2023-06-12)
2.1.3 (2023-05-15)
- client: Respect retry attempts when server goes away after connecting in single connection mode (#59) (e895c5b), closes #55
- handler: Detect
ExecutionArgs
inonSubscribe
return value (a16b921), closes #58
2.1.2 (2023-05-10)
2.1.1 (2023-03-31)
- Add file extensions to imports/exports in ESM type definitions (bbf23b1)
2.1.0 (2023-02-17)
- use/express,use/fastify: Resolve body if previously parsed (6573e94)
- handler: Export handler options type for each integration (2a2e517)
2.0.0 (2022-12-20)
- handler: The handler is now server agnostic and can run anywhere
- Core of
graphql-sse
is now server agnostic and as such offers a handler that implements a generic request/response model - Handler does not await for whole operation to complete anymore. Only the processing part (parsing, validating and executing)
- GraphQL context is now typed
- Hook arguments have been changed, they're not providing the Node native req/res anymore - they instead provide the generic request/response
onSubscribe
hook can now return an execution result too (useful for caching for example)- Throwing in
onNext
andonComplete
hooks will bubble the error to the returned iterator
Even though the core of graphql-sse is now completely server agnostic, there are adapters to ease the integration with existing solutions. Migrating is actually not a headache!
Beware that the adapters don't handle internal errors, it's your responsibility to take care of that and behave accordingly.
import http from 'http';
- import { createHandler } from 'graphql-sse';
+ import { createHandler } from 'graphql-sse/lib/use/http';
// Create the GraphQL over SSE handler
const handler = createHandler({ schema });
// Create an HTTP server using the handler on `/graphql/stream`
const server = http.createServer((req, res) => {
if (req.url.startsWith('/graphql/stream')) {
return handler(req, res);
}
res.writeHead(404).end();
});
server.listen(4000);
console.log('Listening to port 4000');
import fs from 'fs';
import http2 from 'http2';
- import { createHandler } from 'graphql-sse';
+ import { createHandler } from 'graphql-sse/lib/use/http2';
// Create the GraphQL over SSE handler
const handler = createHandler({ schema });
// Create an HTTP server using the handler on `/graphql/stream`
const server = http.createServer((req, res) => {
if (req.url.startsWith('/graphql/stream')) {
return handler(req, res);
}
res.writeHead(404).end();
});
server.listen(4000);
console.log('Listening to port 4000');
import express from 'express'; // yarn add express
- import { createHandler } from 'graphql-sse';
+ import { createHandler } from 'graphql-sse/lib/use/express';
// Create the GraphQL over SSE handler
const handler = createHandler({ schema });
// Create an express app
const app = express();
// Serve all methods on `/graphql/stream`
app.use('/graphql/stream', handler);
server.listen(4000);
console.log('Listening to port 4000');
import Fastify from 'fastify'; // yarn add fastify
- import { createHandler } from 'graphql-sse';
+ import { createHandler } from 'graphql-sse/lib/use/fastify';
// Create the GraphQL over SSE handler
const handler = createHandler({ schema });
// Create a fastify app
const fastify = Fastify();
// Serve all methods on `/graphql/stream`
fastify.all('/graphql/stream', handler);
fastify.listen({ port: 4000 });
console.log('Listening to port 4000');
1.3.2 (2022-12-06)
1.3.1 (2022-12-05)
- client: Abort request when reporting error (91057bd)
- client: Operation requests are of application/json content-type (0084de7)
1.3.0 (2022-07-20)
1.2.5 (2022-07-17)
- client: Leverage active streams for reliable network error retries (607b468)
1.2.4 (2022-07-01)
- Add types path to package.json
exports
(44f95b6)
1.2.3 (2022-06-13)
1.2.2 (2022-06-09)
- client: Network errors during event emission contain the keyword "stream" in Firefox (054f16b)
1.2.1 (2022-06-09)
- client: Avoid recreating result variables when reading the response stream (16f6a6c)
1.2.0 (2022-04-14)
- client: TypeScript generic for ensuring proper arguments when using "single connection mode" (be2ae7d)
1.1.0 (2022-03-09)
- client: Add
credentials
property for requests (79d0266) - client: Add
lazyCloseTimeout
as a close timeout after last operation completes (16e5e31), closes #17
1.0.6 (2021-11-18)
- client: Avoid bundling DOM types, have the implementor supply his own
Response
type (98780c0) - handler: Support generics for requests and responses (9ab10c0)
1.0.5 (2021-11-02)
- client: Should not call complete after subscription error (d8b7634)
- handler: Use 3rd
body
argument only if is object or string (2062579)
1.0.4 (2021-09-08)
- Define graphql execution results (89da803)
- server: Operation result can be async generator or iterable (24b6078)
1.0.3 (2021-08-26)
- Bump
graphql
version to v16 in package.json (af219f9)
1.0.2 (2021-08-26)
- Add support for
graphql@v16
(89367f2)
1.0.1 (2021-08-23)
- Prefer
X-GraphQL-Event-Stream-Token
header name for clarity (9aaa0a9)