Skip to content

Commit 206d483

Browse files
committed
Change default keepalive period to 20 seconds
A 30 second timeout is a commonly used default for websocket connections (e.g. this is the default in Jetty). Reducing the default keepalive period from 30 to 20 seconds should more reliably prevent timeouts in the most common case.
1 parent bcc35a7 commit 206d483

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ring/websocket/keepalive.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
(if (ws/websocket-response? response)
1717
(let [listener (::ws/listener response)
1818
executor (:executor options @default-schedule-executor)
19-
period (:period options 30000)
19+
period (:period options 20000)
2020
task (promise)]
2121
(assoc response ::ws/listener
2222
(reify wsp/Listener
@@ -46,7 +46,7 @@
4646
"Middleware that adds a periodic ping to WebSocket responses, in order to
4747
stop them from timing out. Takes the following options:
4848
49-
:period - the time in milliseconds between pings (default 30000)
49+
:period - the time in milliseconds between pings (default 20000)
5050
:executor - a custom ScheduledExecutorService to handle scheduling"
5151
([handler]
5252
(wrap-websocket-keepalive handler {}))

0 commit comments

Comments
 (0)