public DefaultWebSocketSession extends WebSocketSession
Default websocket session with ping-pong and timeout processing and built-in DefaultWebSocketSession.getCloseReason population
DefaultWebSocketSession.getCloseReasonWebSocketSession.DefaultImpls| Modifier and Type | Method and Description |
|---|---|
kotlinx.coroutines.Deferred<io.ktor.http.cio.websocket.CloseReason> |
getCloseReason()
A close reason for this session. It could be
null if a session is terminated with no close reason
(for example due to connection failure). |
long |
getPingIntervalMillis()
Ping interval or
-1L to disable pinger. Please note that pongs will be handled despite of this setting. |
long |
getTimeoutMillis()
A timeout to wait for pong reply to ping otherwise the session will be terminated immediately.
It doesn't have any effect if
DefaultWebSocketSession.getPingIntervalMillis is -1 (pinger is disabled). |
void |
setPingIntervalMillis(long p)
Ping interval or
-1L to disable pinger. Please note that pongs will be handled despite of this setting. |
void |
setTimeoutMillis(long p)
A timeout to wait for pong reply to ping otherwise the session will be terminated immediately.
It doesn't have any effect if
DefaultWebSocketSession.getPingIntervalMillis is -1 (pinger is disabled). |
close, flush, getDispatcher, getIncoming, getMasking, getMaxFrameSize, getOutgoing, send, setMasking, setMaxFrameSize, terminatelong getPingIntervalMillis()
Ping interval or -1L to disable pinger. Please note that pongs will be handled despite of this setting.
void setPingIntervalMillis(long p)
Ping interval or -1L to disable pinger. Please note that pongs will be handled despite of this setting.
long getTimeoutMillis()
A timeout to wait for pong reply to ping otherwise the session will be terminated immediately.
It doesn't have any effect if DefaultWebSocketSession.getPingIntervalMillis is -1 (pinger is disabled).
void setTimeoutMillis(long p)
A timeout to wait for pong reply to ping otherwise the session will be terminated immediately.
It doesn't have any effect if DefaultWebSocketSession.getPingIntervalMillis is -1 (pinger is disabled).
kotlinx.coroutines.Deferred<io.ktor.http.cio.websocket.CloseReason> getCloseReason()
A close reason for this session. It could be null if a session is terminated with no close reason
(for example due to connection failure).