What is the timeout of 'use server' functions?
Context: I plan to use long polling in an app
I couldn't find any documentation on how to control timeouts for server functions.
How should this be handled?
6 Replies
Not sure if I understand correctly:
You want to poll data from a server function with an interval of x seconds. Is that correct?
Then you would do something like this.
Not quite what I was asking.
I intend to keep a connection open extended time like 30 - 60 seconds for a long running POST request - in this case a
use server
function
Short polls are strait forward. But what happens if the server function is hanging for longer polls?
Or is this generally bad practice?Hope this illustration helps:
Think of it as a scrappy way of avoiding the complexity of websocket
While avoiding the increased load on database of short polling
Ideally, I should probably use server sent events, but is that possible in Solid Start?
Then maybe streaming the response back may be an option?
Or as you said, use a web socket.
Server functions don’t have a built in timeout afaik