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:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,java.nio.channels.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
WebSocketChannelwhich 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 byteOPCODE_BINARYprotected static byteOPCODE_CLOSEprotected static byteOPCODE_CONTprotected static byteOPCODE_PINGprotected static byteOPCODE_PONGprotected static byteOPCODE_TEXT-
Fields inherited from class io.undertow.websockets.core.WebSocketChannel
extensionFunction, extensionsSupported, fragmentedChannel, hasReservedOpCode, WEB_SOCKETS_READ_TIMEOUT, WEB_SOCKETS_WRITE_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description WebSocket07Channel(org.xnio.StreamConnection channel, ByteBufferPool bufferPool, java.lang.String wsUrl, java.lang.String subProtocol, boolean client, boolean allowExtensions, ExtensionFunction extensionFunction, java.util.Set<WebSocketChannel> openConnections, org.xnio.OptionMap options)Create a newWebSocket07Channel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseSubChannels()Method that is called when the channel is being forcibly closed, and all sub stream sink/source channels should also be forcibly closed.protected StreamSinkFrameChannelcreateStreamSinkChannel(WebSocketFrameType type)Create a new StreamSinkFrameChannel which can be used to send a WebSocket Frame of the typeWebSocketFrameType.protected voidmarkReadsBroken(java.lang.Throwable cause)Called when a source sub channel fails to fulfil its contract, and leaves the channel in an inconsistent state.protected WebSocketChannel.PartialFramereceiveFrame()Create a newStreamSourceFrameChannelwhich 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, java.lang.String wsUrl, java.lang.String subProtocol, boolean client, boolean allowExtensions, ExtensionFunction extensionFunction, java.util.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 Detail
-
receiveFrame
protected WebSocketChannel.PartialFrame 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
protected void markReadsBroken(java.lang.Throwable cause)
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
protected StreamSinkFrameChannel createStreamSinkChannel(WebSocketFrameType type)
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
-
-