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
WebSocketChannel
which is used for WebSocketVersion.V08
- Author:
- Norman Maurer
-
Nested Class Summary
Nested classes/interfaces inherited from class io.undertow.websockets.core.WebSocketChannel
WebSocketChannel.PartialFrame
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final byte
protected static final byte
protected static final byte
protected static final byte
protected static final byte
protected static final byte
Fields inherited from class io.undertow.websockets.core.WebSocketChannel
extensionFunction, extensionsSupported, fragmentedChannel, hasReservedOpCode
Fields inherited from interface org.xnio.channels.Configurable
EMPTY
-
Constructor Summary
ConstructorsConstructorDescriptionWebSocket07Channel
(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
Modifier and TypeMethodDescriptionprotected void
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
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
Create a newStreamSourceFrameChannel
which can be used to read the data of the received FrameMethods 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 Details
-
OPCODE_CONT
protected static final byte OPCODE_CONT- See Also:
-
OPCODE_TEXT
protected static final byte OPCODE_TEXT- See Also:
-
OPCODE_BINARY
protected static final byte OPCODE_BINARY- See Also:
-
OPCODE_CLOSE
protected static final byte OPCODE_CLOSE- See Also:
-
OPCODE_PING
protected static final byte OPCODE_PING- See Also:
-
OPCODE_PONG
protected static final byte OPCODE_PONG- See Also:
-
-
Constructor Details
-
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 Details
-
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
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
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
-