Package io.undertow.websockets.core
Class AbstractReceiveListener
- java.lang.Object
-
- io.undertow.websockets.core.AbstractReceiveListener
-
- All Implemented Interfaces:
java.util.EventListener
,org.xnio.ChannelListener<WebSocketChannel>
public abstract class AbstractReceiveListener extends java.lang.Object implements org.xnio.ChannelListener<WebSocketChannel>
A receive listener that performs a callback when it receives a message- Author:
- Stuart Douglas
-
-
Constructor Summary
Constructors Constructor Description AbstractReceiveListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
bufferFullMessage(StreamSourceFrameChannel messageChannel)
Utility method that reads a full text or binary message, including all fragmented parts.protected long
getMaxBinaryBufferSize()
protected long
getMaxCloseBufferSize()
protected long
getMaxPingBufferSize()
protected long
getMaxPongBufferSize()
protected long
getMaxTextBufferSize()
void
handleEvent(WebSocketChannel channel)
protected void
onBinary(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel)
protected void
onClose(WebSocketChannel webSocketChannel, StreamSourceFrameChannel channel)
protected void
onCloseMessage(CloseMessage cm, WebSocketChannel channel)
protected void
onError(WebSocketChannel channel, java.lang.Throwable error)
protected void
onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message)
protected void
onFullCloseMessage(WebSocketChannel channel, BufferedBinaryMessage message)
protected void
onFullPingMessage(WebSocketChannel channel, BufferedBinaryMessage message)
protected void
onFullPongMessage(WebSocketChannel channel, BufferedBinaryMessage message)
protected void
onFullTextMessage(WebSocketChannel channel, BufferedTextMessage message)
protected void
onPing(WebSocketChannel webSocketChannel, StreamSourceFrameChannel channel)
protected void
onPong(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel)
protected void
onText(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel)
-
-
-
Method Detail
-
handleEvent
public void handleEvent(WebSocketChannel channel)
- Specified by:
handleEvent
in interfaceorg.xnio.ChannelListener<WebSocketChannel>
-
onPing
protected void onPing(WebSocketChannel webSocketChannel, StreamSourceFrameChannel channel) throws java.io.IOException
- Throws:
java.io.IOException
-
onClose
protected void onClose(WebSocketChannel webSocketChannel, StreamSourceFrameChannel channel) throws java.io.IOException
- Throws:
java.io.IOException
-
onPong
protected void onPong(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel) throws java.io.IOException
- Throws:
java.io.IOException
-
onText
protected void onText(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel) throws java.io.IOException
- Throws:
java.io.IOException
-
onBinary
protected void onBinary(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel) throws java.io.IOException
- Throws:
java.io.IOException
-
onError
protected void onError(WebSocketChannel channel, java.lang.Throwable error)
-
bufferFullMessage
protected final void bufferFullMessage(StreamSourceFrameChannel messageChannel)
Utility method that reads a full text or binary message, including all fragmented parts. Once the full message is read then theonFullTextMessage(WebSocketChannel, BufferedTextMessage)
oronFullBinaryMessage(WebSocketChannel, BufferedBinaryMessage)
method will be invoked.- Parameters:
messageChannel
- The message channel
-
getMaxBinaryBufferSize
protected long getMaxBinaryBufferSize()
-
getMaxPongBufferSize
protected long getMaxPongBufferSize()
-
getMaxCloseBufferSize
protected long getMaxCloseBufferSize()
-
getMaxPingBufferSize
protected long getMaxPingBufferSize()
-
getMaxTextBufferSize
protected long getMaxTextBufferSize()
-
onFullTextMessage
protected void onFullTextMessage(WebSocketChannel channel, BufferedTextMessage message) throws java.io.IOException
- Throws:
java.io.IOException
-
onFullBinaryMessage
protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws java.io.IOException
- Throws:
java.io.IOException
-
onFullPingMessage
protected void onFullPingMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws java.io.IOException
- Throws:
java.io.IOException
-
onFullPongMessage
protected void onFullPongMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws java.io.IOException
- Throws:
java.io.IOException
-
onFullCloseMessage
protected void onFullCloseMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws java.io.IOException
- Throws:
java.io.IOException
-
onCloseMessage
protected void onCloseMessage(CloseMessage cm, WebSocketChannel channel)
-
-