Skip to content

Commit

Permalink
fix: creating sse connection for each gql subscribe (#1154)
Browse files Browse the repository at this point in the history
  • Loading branch information
timonmasberg authored Jan 1, 2025
1 parent fc13451 commit 9a355bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
All,
Controller,
OnModuleInit,
Post,
Req,
Res,
ServiceUnavailableException,
Expand All @@ -28,7 +28,7 @@ export class GraphqlSubscriptionsController implements OnModuleInit {
});
}

@Post()
@All()
subscriptionHandler(
@Req() req: KordisRequest,
@Res() res: Response,
Expand Down
1 change: 1 addition & 0 deletions libs/spa/core/graphql/src/lib/graphql.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class GraphqlModule {
},
new SSELink({
url: sseEndpoint,
singleConnection: true,
headers: () => ({
...authHeaderFactory(),
}),
Expand Down
4 changes: 2 additions & 2 deletions libs/spa/core/graphql/src/lib/sse-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { print } from 'graphql';
import { Client, ClientOptions, createClient } from 'graphql-sse';

export class SSELink extends ApolloLink {
private client: Client;
private client: Client<true>;

constructor(options: ClientOptions) {
constructor(options: ClientOptions<true>) {
super();
this.client = createClient(options);
}
Expand Down

0 comments on commit 9a355bc

Please sign in to comment.