Called when a subscriber disconnects as result of an SSE timeout. The server provides two arguments, sub
and elapsed
. sub
is the table returned from the subscribe
function, and elapsed
is the total milliseconds that the subscriber was connected. The server accepts an optional return value which is the number of milliseconds that the client should wait before reconnecting. If not given, it will default to the value given by the --timeout-retry
option.
NOTE: The unsubscribe(sub)
function will be called immediately after this.
function timeout(sub, elapsed)
-- Subscriber timed-out and was disconnected.
end