kula
kula
TtRPC
Created by kula on 2/20/2025 in #❓-help
How can I break this loop when the client disconnects?
onReceiveMessage: protectedProcedure .input(receiveSchema) .subscription(async function* ({ ctx, input }) { let lastCheck = input.lastMessageTime ?? Date.now() while (true) { await new Promise(resolve => setTimeout(resolve, 1000)) } }) I am currently finding issues with not receiving events from client closures in NextJS. How can I break this loop when the client disconnects? When I use Observable, I can exit the loop but Observable is deprecated trpc version is 11.0.0-rc.446
1 replies