Package io.undertow.websockets.core
Class AbstractReceiveListener
java.lang.Object
io.undertow.websockets.core.AbstractReceiveListener
- All Implemented Interfaces:
EventListener,org.xnio.ChannelListener<WebSocketChannel>
public abstract class AbstractReceiveListener
extends Object
implements org.xnio.ChannelListener<WebSocketChannel>
A receive listener that performs a callback when it receives a message
- Author:
- Stuart Douglas
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidbufferFullMessage(StreamSourceFrameChannel messageChannel) Utility method that reads a full text or binary message, including all fragmented parts.protected longprotected longprotected longprotected longprotected longvoidhandleEvent(WebSocketChannel channel) protected voidonBinary(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel) protected voidonClose(WebSocketChannel webSocketChannel, StreamSourceFrameChannel channel) protected voidonCloseMessage(CloseMessage cm, WebSocketChannel channel) protected voidonError(WebSocketChannel channel, Throwable error) protected voidonFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) protected voidonFullCloseMessage(WebSocketChannel channel, BufferedBinaryMessage message) protected voidonFullPingMessage(WebSocketChannel channel, BufferedBinaryMessage message) protected voidonFullPongMessage(WebSocketChannel channel, BufferedBinaryMessage message) protected voidonFullTextMessage(WebSocketChannel channel, BufferedTextMessage message) protected voidonPing(WebSocketChannel webSocketChannel, StreamSourceFrameChannel channel) protected voidonPong(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel) protected voidonText(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel)
-
Constructor Details
-
AbstractReceiveListener
public AbstractReceiveListener()
-
-
Method Details
-
handleEvent
- Specified by:
handleEventin interfaceorg.xnio.ChannelListener<WebSocketChannel>
-
onPing
protected void onPing(WebSocketChannel webSocketChannel, StreamSourceFrameChannel channel) throws IOException - Throws:
IOException
-
onClose
protected void onClose(WebSocketChannel webSocketChannel, StreamSourceFrameChannel channel) throws IOException - Throws:
IOException
-
onPong
protected void onPong(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel) throws IOException - Throws:
IOException
-
onText
protected void onText(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel) throws IOException - Throws:
IOException
-
onBinary
protected void onBinary(WebSocketChannel webSocketChannel, StreamSourceFrameChannel messageChannel) throws IOException - Throws:
IOException
-
onError
-
bufferFullMessage
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 IOException - Throws:
IOException
-
onFullBinaryMessage
protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws IOException - Throws:
IOException
-
onFullPingMessage
protected void onFullPingMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws IOException - Throws:
IOException
-
onFullPongMessage
protected void onFullPongMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws IOException - Throws:
IOException
-
onFullCloseMessage
protected void onFullCloseMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws IOException - Throws:
IOException
-
onCloseMessage
-