Asynchronous subscribe and unsubscribe methods in observable
Hello,
I have been looking at the documentation about subscriptions but I am not sure about one thing. This is the article I am looking at: https://trpc.io/docs/subscriptions
The code example mentions that the event emitter could be replaced by Redis. However, I am not sure how this would work. When doing PubSub with Redis your subscribe/unsubscribe methods are typically asynchronous. The "observable" from tRPC only takes a synchronous subscribe function and must return a synchronous unsubscribe function.
I could just not await the result of the subscribe call but then I may run into uncaught errors when subscribing doesn't work. I could catch those but as I see it I would have no way to return them to the client. How is this supposed to be done?
Subscriptions / WebSockets | tRPC
Using Subscriptions
0 Replies