Skip to content

Context per emit/next #636

Answered by intellix
intellix asked this question in Q&A
Mar 27, 2025 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

we've managed to get what we wanted with a patch to add another hook:

patches/graphql-ws+5.12.1.patch

diff --git a/node_modules/graphql-ws/lib/server.d.ts b/node_modules/graphql-ws/lib/server.d.ts
index adfa2b5..80319cd 100644
--- a/node_modules/graphql-ws/lib/server.d.ts
+++ b/node_modules/graphql-ws/lib/server.d.ts
@@ -266,6 +266,10 @@ export interface ServerOptions<P extends ConnectionInitMessage['payload'] = Conn
      * will still be called.
      */
     onComplete?: (ctx: Context<P, E>, message: CompleteMessage) => Promise<void> | void;
+
+    /** Custom Hook to execute before every subscription emit */
+   beforeEmitExecute?: (args: ExecutionArgs) => void | Promise<void>;
+
     /…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@enisdenjo
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by enisdenjo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #635 on March 28, 2025 15:26.