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 byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteFields inherited from class io.undertow.websockets.core.WebSocketChannel
extensionFunction, extensionsSupported, fragmentedChannel, hasReservedOpCodeFields 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 voidMethod that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.protected StreamSinkFrameChannelCreate a new StreamSinkFrameChannel which can be used to send a WebSocket Frame of the typeWebSocketFrameType.protected voidmarkReadsBroken(Throwable cause) Called when a source sub channel fails to fulfil its contract, and leaves the channel in an inconsistent state.protected WebSocketChannel.PartialFrameCreate a newStreamSourceFrameChannelwhich 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, setCloseReasonMethods 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- TheStreamConnectionover which the WebSocket Frames should get send and received. Be aware that it already must be "upgraded".bufferPool- TheByteBufferPoolwhich will be used to acquireByteBuffer's from.wsUrl- The url for which theWebSocket07Channelwas created.
-
-
Method Details
-
receiveFrame
Description copied from class:WebSocketChannelCreate a newStreamSourceFrameChannelwhich can be used to read the data of the received Frame- Specified by:
receiveFramein classWebSocketChannel- Returns:
- channel A
StreamSourceFrameChannelwill be used to read a Frame from. This will returnnullif the rightStreamSourceFrameChannelcould not be detected with the given buffer and so more data is needed.
-
markReadsBroken
Description copied from class:AbstractFramedChannelCalled 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:
markReadsBrokenin classWebSocketChannel- Parameters:
cause- The possibly null cause
-
closeSubChannels
protected void closeSubChannels()Description copied from class:AbstractFramedChannelMethod that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.- Specified by:
closeSubChannelsin classAbstractFramedChannel<WebSocketChannel,StreamSourceFrameChannel, StreamSinkFrameChannel>
-
createStreamSinkChannel
Description copied from class:WebSocketChannelCreate a new StreamSinkFrameChannel which can be used to send a WebSocket Frame of the typeWebSocketFrameType.- Specified by:
createStreamSinkChannelin classWebSocketChannel- Parameters:
type- TheWebSocketFrameTypeof the WebSocketFrame which will be send over thisStreamSinkFrameChannel
-