const listSubscription= profileProcedure .input( z.object({ matchId: z.string(), }), ) .subscription(async function* ({ signal, input, ctx }) { console.log("connection opened"); await ctx.eventSub.subscribe(input.matchId); try { for await (const [_, message] of on(ctx.eventSub, "message", { signal: signal, })) { const post = JSON.parse(message); yield post; } } finally { console.log("connection closed"); ctx.eventSub.unsubscribe(input.matchId); } })