const postRouter = t.router({
randomNumber: t.procedure.subscription(() => {
return observable<{ randomNumber: number }>((emit) => {
const timer = setInterval(() => {
// emits a number every second
emit.next({ randomNumber: Math.round(Math.random() * 10000) })
}, 1000)
return () => {
clearInterval(timer)
}
})
})
})
How would one call this subscription with an argument? Like if I only wanted it to emit if the random number was even or odd bases on an arg.
Thanks for any direction