io.undertow.websockets.core.protocol.version07

## 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 for `WebSocketVersion.V08`

Author:
  Norman Maurer

### Nested Class Summary

### Nested classes/interfaces inherited from class io.undertow.websockets.core.WebSocketChannel

`WebSocketChannel.PartialFrame`

### Field Summary

Fields
`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`

### Fields inherited from interface org.xnio.channels.Configurable

`EMPTY`

### Constructor Summary

Constructors
Constructor and 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 new `WebSocket07Channel`

### Method Summary

All Methods Instance Methods Concrete Methods
`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 type `WebSocketFrameType`.
`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 new `StreamSourceFrameChannel` 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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### 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 new `WebSocket07Channel`

Parameters:
  `channel` - The `StreamConnection` over which the WebSocket Frames should get send and received. Be aware that it already must be "upgraded".
  `bufferPool` - The `ByteBufferPool` which will be used to acquire `ByteBuffer`'s from.
  `wsUrl` - The url for which the `WebSocket07Channel` was created.

### Method Detail

#### receiveFrame

    protected WebSocketChannel.PartialFrame receiveFrame()

Description copied from class: `WebSocketChannel`
Create a new `StreamSourceFrameChannel` which can be used to read the data of the received Frame

Specified by:
  `receiveFrame` in class `WebSocketChannel`
Returns:
  channel A `StreamSourceFrameChannel` will be used to read a Frame from. This will return `null` if the right `StreamSourceFrameChannel` 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 class `WebSocketChannel`
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 class `AbstractFramedChannel<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 type `WebSocketFrameType`.

Specified by:
  `createStreamSinkChannel` in class `WebSocketChannel`
Parameters:
  `type` - The `WebSocketFrameType` of the WebSocketFrame which will be send over this `StreamSinkFrameChannel`