public interface WsListener
WebSocket listener.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Received close.default void
Error occurred.onHttpUpgrade
(HttpPrologue prologue, Headers headers) Invoked during handshake process.default void
onMessage
(WsSession session, BufferData buffer, boolean last) Received binary fragment.default void
Received text fragment.default void
Session is open.default void
onPing
(WsSession session, BufferData buffer) Received ping.default void
onPong
(WsSession session, BufferData buffer) Received pong.
-
Method Details
-
onMessage
Received text fragment.- Parameters:
session
- WebSocket sessiontext
- text receivedlast
- is this last fragment
-
onMessage
Received binary fragment.- Parameters:
session
- WebSocket sessionbuffer
- buffer with datalast
- is this last fragment
-
onPing
Received ping.- Parameters:
session
- WebSocket sessionbuffer
- buffer with data
-
onPong
Received pong.- Parameters:
session
- WebSocket sessionbuffer
- buffer with data
-
onClose
Received close.- Parameters:
session
- WebSocket sessionstatus
- close statusreason
- reason of close
-
onError
Error occurred.- Parameters:
session
- WebSocket sessiont
- throwable caught
-
onOpen
Session is open.- Parameters:
session
- WebSocket session
-
onHttpUpgrade
default Optional<Headers> onHttpUpgrade(HttpPrologue prologue, Headers headers) throws WsUpgradeException Invoked during handshake process. Can be used to negotiate sub-protocols and/or reject an upgrade by throwingWsUpgradeException
.- Parameters:
prologue
- the http handshake requestheaders
- headers in request- Returns:
- headers to be included in handshake response
- Throws:
WsUpgradeException
- if handshake is rejected
-