Class WebSocket07Channel
- java.lang.Object
-
- io.undertow.server.protocol.framed.AbstractFramedChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>
-
- io.undertow.websockets.core.WebSocketChannel
-
- io.undertow.websockets.core.protocol.version07.WebSocket07Channel
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,InterruptibleChannel
,org.xnio.channels.BoundChannel
,org.xnio.channels.CloseableChannel
,org.xnio.channels.Configurable
,org.xnio.channels.ConnectedChannel
- Direct Known Subclasses:
WebSocket08Channel
,WebSocket13Channel
public class WebSocket07Channel extends WebSocketChannel
WebSocketChannel
which is used forWebSocketVersion.V08
- Author:
- Norman Maurer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.undertow.websockets.core.WebSocketChannel
WebSocketChannel.PartialFrame
-
-
Field Summary
Fields Modifier and Type Field Description protected static byte
OPCODE_BINARY
protected static byte
OPCODE_CLOSE
protected static byte
OPCODE_CONT
protected static byte
OPCODE_PING
protected static byte
OPCODE_PONG
protected static byte
OPCODE_TEXT
-
Fields inherited from class io.undertow.websockets.core.WebSocketChannel
extensionFunction, extensionsSupported, fragmentedChannel, hasReservedOpCode
-
-
Constructor Summary
Constructors Constructor Description WebSocket07Channel(org.xnio.StreamConnection channel, ByteBufferPool bufferPool, String wsUrl, String subProtocol, boolean client, boolean allowExtensions, ExtensionFunction extensionFunction, Set<WebSocketChannel> openConnections, org.xnio.OptionMap options)
Create a newWebSocket07Channel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeSubChannels()
Method that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.protected StreamSinkFrameChannel
createStreamSinkChannel(WebSocketFrameType type)
Create a new StreamSinkFrameChannel which can be used to send a WebSocket Frame of the typeWebSocketFrameType
.protected void
markReadsBroken(Throwable cause)
Called when a source sub channel fails to fulfil its contract, and leaves the channel in an inconsistent state.protected WebSocketChannel.PartialFrame
receiveFrame()
Create a newStreamSourceFrameChannel
which can be used to read the data of the received Frame-
Methods inherited from class io.undertow.websockets.core.WebSocketChannel
areExtensionsSupported, createChannel, createIdleTimeoutChannel, getAttribute, getCloseCode, getCloseReason, getDestinationAddress, getExtensionFunction, getFramePriority, getPeerConnections, getReceivers, getRequestScheme, getSourceAddress, getSubProtocol, getSubProtocols, getUrl, getVersion, handleBrokenSinkChannel, handleBrokenSourceChannel, isClient, isCloseFrameReceived, isCloseFrameSent, isCloseInitiatedByRemotePeer, isLastFrameReceived, isLastFrameSent, isReadsBroken, isSecure, lastDataRead, parseFrame, send, sendClose, setAttribute, setCloseCode, setCloseReason
-
Methods inherited from class io.undertow.server.protocol.framed.AbstractFramedChannel
addCloseTask, close, flush, flushSenders, getBufferPool, getCloseSetter, getIdleTimeout, getIoThread, getLocalAddress, getLocalAddress, getOption, getPeerAddress, getPeerAddress, getReceiveSetter, getSettings, getUnderlyingConnection, getWorker, isOpen, isReceivesResumed, isRequireExplicitFlush, isWritesBroken, markWritesBroken, queueFrame, recalculateHeldFrames, receive, resumeReceives, setIdleTimeout, setOption, setRequireExplicitFlush, supportsOption, suspendReceives, toString, writeExceptionHandler
-
-
-
-
Field Detail
-
OPCODE_CONT
protected static final byte OPCODE_CONT
- See Also:
- Constant Field Values
-
OPCODE_TEXT
protected static final byte OPCODE_TEXT
- See Also:
- Constant Field Values
-
OPCODE_BINARY
protected static final byte OPCODE_BINARY
- See Also:
- Constant Field Values
-
OPCODE_CLOSE
protected static final byte OPCODE_CLOSE
- See Also:
- Constant Field Values
-
OPCODE_PING
protected static final byte OPCODE_PING
- See Also:
- Constant Field Values
-
OPCODE_PONG
protected static final byte OPCODE_PONG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WebSocket07Channel
public WebSocket07Channel(org.xnio.StreamConnection channel, ByteBufferPool bufferPool, String wsUrl, String subProtocol, boolean client, boolean allowExtensions, ExtensionFunction extensionFunction, Set<WebSocketChannel> openConnections, org.xnio.OptionMap options)
Create a newWebSocket07Channel
- Parameters:
channel
- TheStreamConnection
over which the WebSocket Frames should get send and received. Be aware that it already must be "upgraded".bufferPool
- TheByteBufferPool
which will be used to acquireByteBuffer
's from.wsUrl
- The url for which theWebSocket07Channel
was created.
-
-
Method Detail
-
receiveFrame
protected WebSocketChannel.PartialFrame receiveFrame()
Description copied from class:WebSocketChannel
Create a newStreamSourceFrameChannel
which can be used to read the data of the received Frame- Specified by:
receiveFrame
in classWebSocketChannel
- Returns:
- channel A
StreamSourceFrameChannel
will be used to read a Frame from. This will returnnull
if the rightStreamSourceFrameChannel
could not be detected with the given buffer and so more data is needed.
-
markReadsBroken
protected void markReadsBroken(Throwable cause)
Description copied from class:AbstractFramedChannel
Called when a source sub channel fails to fulfil its contract, and leaves the channel in an inconsistent state.The underlying read side will be forcibly closed.
- Overrides:
markReadsBroken
in classWebSocketChannel
- Parameters:
cause
- The possibly null cause
-
closeSubChannels
protected void closeSubChannels()
Description copied from class:AbstractFramedChannel
Method that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.- Specified by:
closeSubChannels
in classAbstractFramedChannel<WebSocketChannel,StreamSourceFrameChannel,StreamSinkFrameChannel>
-
createStreamSinkChannel
protected StreamSinkFrameChannel createStreamSinkChannel(WebSocketFrameType type)
Description copied from class:WebSocketChannel
Create a new StreamSinkFrameChannel which can be used to send a WebSocket Frame of the typeWebSocketFrameType
.- Specified by:
createStreamSinkChannel
in classWebSocketChannel
- Parameters:
type
- TheWebSocketFrameType
of the WebSocketFrame which will be send over thisStreamSinkFrameChannel
-
-