KevinEdry / nestjs-trpc

Providing native support for decorators and implement an opinionated approach that aligns with NestJS conventions.
https://NestJS-tRPC.io
MIT License
71 stars 6 forks source link

Subscription do not existed #3

Open xiaocode opened 1 month ago

xiaocode commented 1 month ago

I can not find @Subscription in package

KevinEdry commented 1 month ago

Yeah, I haven't implemented it yet, I wanted to test that the initial implementation is stable before going and implementing the subscription feature. Is that a critical feature for your use-case?

xiaocode commented 1 month ago

Yeah, I want to use websocket in nest.js with trpc, so Subscription is necessary.

KevinEdry commented 1 month ago

I'll try and figure out how to incorporate the two then.

KevinEdry commented 1 month ago

@xiaocode it seems like trpc is using ws as per their docs here. I am thinking of going with the nest approach here for abstraction with the implementation to look something like this:

 @Subscription("eventName", {
   input: z.object({ userId: z.string() }),
   output: z.string(),
 })
 async handleEvent(
   @Input('userId') userId: string,
 ): string {
  return userId
 }

Wdyt?

xiaocode commented 1 month ago

It`s OK!

KevinEdry commented 4 weeks ago

Hey @xiaocode, subscriptions will come when trpc v11 will go out of alpha.