How to return custom error code if onSubscribe
throws an error ?
#167
-
Use CaseI am using graphql-ws with My approach
ProblemBecause of an error code check in client.ts, returning the How do I throw a non 1011 error code to the client, if onSubscribe fails, so that I can retry connection? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Answered in full detail here: #166 (reply in thread). TL;DR to close the socket manually with whatever close event you wish, you simply use the socket in the context. Something like |
Beta Was this translation helpful? Give feedback.
Answered in full detail here: #166 (reply in thread).
TL;DR to close the socket manually with whatever close event you wish, you simply use the socket in the context. Something like
context.extra.socket.close(4401, 'Unauthorized')
.