triggerdotdev / trigger.dev

Trigger.dev is the open source background jobs platform.
https://trigger.dev/changelog
Apache License 2.0
9.5k stars 596 forks source link

feat: Websocket support for status APIs #828

Open krzkaczor opened 11 months ago

krzkaczor commented 11 months ago

Is your feature request related to a problem? Please describe.

I am surprised that old-school HTTP pooling is used in react package instead of something like websockets.

Describe the solution you'd like to see

Websockets could provide faster updates (but ofc there is some architecture overhead). Is this something that is on your roadmap?

Describe alternate solutions

-

Additional information

No response

matt-aitken commented 11 months ago

Yep we’ve talked about adding web socket and Server Sent Event support. We’d use Redis PubSub to make it easier to build I think.

@krzkaczor out of interest, which of the hooks are you using/thinking of using? We have a few different ones and I’m interested in figuring out the most valuable.

krzkaczor commented 11 months ago

I want to be able to track the progress of a job so I added a custom status to the job as defined in docs. On the client side, I use useEventRunStatuses hook (inside next.js app).

For now, it's nothing more than a PoC but I am absolutely loving trigger.dev so far. I can't wait to build something production-ready with it ;)

matt-aitken commented 11 months ago

Thanks!

I'm glad you said the Status hooks because we're going to be taking that system and turning it into a more powerful notification system. React hooks, web sockets, SSE etc will be possible ways to subscribe to it.