org.xnio.channels.ConnectedChannel which can be used to send and receive WebSocket Frames.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | WebSocketChannel.
Interface that represents a frame channel that is in the process of being created |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private final boolean | |
| private static final CloseMessage | |
| private volatile int | |
| private volatile boolean | |
| private volatile boolean | |
| private volatile boolean | closeInitiatedByRemotePeer
If this is true then the web socket close was initiated by the remote peer |
| private volatile String | |
| protected final ExtensionFunction | |
| protected final boolean | |
| protected StreamSourceFrameChannel | |
| protected final boolean | |
| private volatile WebSocketChannel. | partialFrame
an incoming frame that has not been created yet |
| private final Set | peerConnections
Represents all web socket channels that are attached to the same endpoint. |
| private final String | |
| private final WebSocketVersion | |
| private final String |
| Access | Constructor and Description |
|---|---|
| protected | WebSocketChannel(final StreamConnection
The connectedStreamChannel, ByteBufferPool org. over which the WebSocket Frames should get send and received.
Be aware that it already must be "upgraded".The bufferPool, WebSocketVersion org. which will be used to acquire java.'s from.The version, String WebSocketVersion of the WebSocketChannelThe url for which the channel was created. wsUrl, String subProtocol, final boolean client, boolean extensionsSupported, final ExtensionFunction extensionFunction, Set<WebSocketChannel> The concurrent set that is used to track open connections associtated with an endpoint peerConnections, OptionMap options)Create a new |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| protected StreamSourceFrameChannel | createChannel(FrameHeaderData
The header data, as returned by frameHeaderData, PooledByteBuffer parseFrame(java.Any additional data for the frame that has already been read. This may not be the complete frame contents frameData)Implements abstract io. Method that creates the actual stream source channel implementation that is in use. |
| protected IdleTimeoutConduit | createIdleTimeoutChannel(final StreamConnection connectedStreamChannel)
Overrides io.
|
| protected abstract StreamSinkFrameChannel | createStreamSinkChannel(WebSocketFrameType
The type)WebSocketFrameType of the WebSocketFrame which will be send over this StreamSinkFrameChannelCreate a new StreamSinkFrameChannel which can be used to send a WebSocket Frame of the type |
| public final Object | |
| public int | |
| public String | |
| public InetSocketAddress | Returns: the destination address of the WebSocket ChannelOverrides io. Get the destination address of the WebSocket Channel. |
| public ExtensionFunction | |
| protected WebSocketFramePriority | |
| public Set | Returns: all 'peer' web socket connectionsReturns all 'peer' web socket connections that were created from the same endpoint. |
| protected Collection | getReceivers()
Implements abstract io.
|
| public String | |
| public InetSocketAddress | Returns: the source address of the WebSocket ChannelOverrides io. Get the source address of the WebSocket Channel. |
| public String | |
| public Set | |
| public String | |
| public WebSocketVersion | Returns: version TheWebSocketVersion which is in useReturn the |
| protected void | handleBrokenSinkChannel(Throwable e)
Implements abstract io. Method that is invoked when then write side of a channel is broken. |
| protected void | handleBrokenSourceChannel(Throwable e)
Implements abstract io. Method that is invoked when the read side of the channel is broken. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | Returns: true if the remote peer closed the connectionIf this is true the session is being closed because the remote peer sent a close frame |
| protected boolean | isLastFrameReceived()
Implements abstract io. Returns true if the protocol specific final frame has been received. |
| protected boolean | isLastFrameSent()
Implements abstract io.
|
| protected boolean | |
| public boolean | |
| protected void | lastDataRead()
Overrides io. Method than is invoked when read() returns -1. |
| protected void | markReadsBroken(Throwable
The possibly null cause cause)Overrides io. Called when a source sub channel fails to fulfil its contract, and leaves the channel in an inconsistent state. |
| protected FrameHeaderData | parseFrame(ByteBuffer
The data that has been read from the channel data)Implements abstract io. Attempts to parse an incoming frame header from the data in the buffer. |
| protected abstract WebSocketChannel. | Returns: channel Aio. will be used to read a Frame from.
This will return null if the right io. could not be detected with the given
buffer and so more data is needed.Create a new |
| public final StreamSinkFrameChannel | send(WebSocketFrameType
The type)WebSocketFrameType for which a StreamSinkChannel should be createdReturns a new |
| public void | |
| public final boolean | |
| public void | |
| public void |
| attributes | back to summary |
|---|---|
| private final Map<String, Object> attributes | |
| client | back to summary |
|---|---|
| private final boolean client | |
| CLOSE_MSG | back to summary |
|---|---|
| private static final CloseMessage CLOSE_MSG | |
| closeCode | back to summary |
|---|---|
| private volatile int closeCode | |
| closeFrameReceived | back to summary |
|---|---|
| private volatile boolean closeFrameReceived | |
| closeFrameSent | back to summary |
|---|---|
| private volatile boolean closeFrameSent | |
| closeInitiatedByRemotePeer | back to summary |
|---|---|
| private volatile boolean closeInitiatedByRemotePeer If this is true then the web socket close was initiated by the remote peer | |
| closeReason | back to summary |
|---|---|
| private volatile String closeReason | |
| extensionFunction | back to summary |
|---|---|
| protected final ExtensionFunction extensionFunction | |
| extensionsSupported | back to summary |
|---|---|
| protected final boolean extensionsSupported | |
| fragmentedChannel | back to summary |
|---|---|
| protected StreamSourceFrameChannel fragmentedChannel | |
| hasReservedOpCode | back to summary |
|---|---|
| protected final boolean hasReservedOpCode | |
| partialFrame | back to summary |
|---|---|
| private volatile WebSocketChannel. an incoming frame that has not been created yet | |
| peerConnections | back to summary |
|---|---|
| private final Set<WebSocketChannel> peerConnections Represents all web socket channels that are attached to the same endpoint. | |
| subProtocol | back to summary |
|---|---|
| private final String subProtocol | |
| version | back to summary |
|---|---|
| private final WebSocketVersion version | |
| wsUrl | back to summary |
|---|---|
| private final String wsUrl | |
| WebSocketChannel | back to summary |
|---|---|
| protected WebSocketChannel(final StreamConnection connectedStreamChannel, ByteBufferPool bufferPool, WebSocketVersion version, String wsUrl, String subProtocol, final boolean client, boolean extensionsSupported, final ExtensionFunction extensionFunction, Set<WebSocketChannel> peerConnections, OptionMap options) Create a new
| |
| areExtensionsSupported | back to summary |
|---|---|
| public boolean areExtensionsSupported() Returns | |
| createChannel | back to summary |
|---|---|
| protected StreamSourceFrameChannel createChannel(FrameHeaderData frameHeaderData, PooledByteBuffer frameData) Implements abstract io. Doc from io. Method that creates the actual stream source channel implementation that is in use.
| |
| createIdleTimeoutChannel | back to summary |
|---|---|
| protected IdleTimeoutConduit createIdleTimeoutChannel(final StreamConnection connectedStreamChannel) Overrides io.
| |
| createStreamSinkChannel | back to summary |
|---|---|
| protected abstract StreamSinkFrameChannel createStreamSinkChannel(WebSocketFrameType type) Create a new StreamSinkFrameChannel which can be used to send a WebSocket Frame of the type
| |
| getAttribute | back to summary |
|---|---|
| public final Object getAttribute(String key) | |
| getCloseCode | back to summary |
|---|---|
public int getCloseCode()
| |
| getCloseReason | back to summary |
|---|---|
public String getCloseReason()
| |
| getDestinationAddress | back to summary |
|---|---|
| public InetSocketAddress getDestinationAddress() Overrides io. Get the destination address of the WebSocket Channel.
| |
| getExtensionFunction | back to summary |
|---|---|
| public ExtensionFunction getExtensionFunction() | |
| getFramePriority | back to summary |
|---|---|
| protected WebSocketFramePriority getFramePriority() Overrides io. | |
| getPeerConnections | back to summary |
|---|---|
| public Set Returns all 'peer' web socket connections that were created from the same endpoint.
| |
| getReceivers | back to summary |
|---|---|
| protected Collection Implements abstract io.
| |
| getRequestScheme | back to summary |
|---|---|
| public String getRequestScheme() Get the request URI scheme. Normally this is one of
| |
| getSourceAddress | back to summary |
|---|---|
| public InetSocketAddress getSourceAddress() Overrides io. Get the source address of the WebSocket Channel.
| |
| getSubProtocol | back to summary |
|---|---|
| public String getSubProtocol() | |
| getSubProtocols | back to summary |
|---|---|
| public Set Deprecated
Returns an unmodifiable
| |
| getUrl | back to summary |
|---|---|
| public String getUrl() Return the URL of the WebSocket endpoint.
| |
| getVersion | back to summary |
|---|---|
| public WebSocketVersion getVersion() Return the
| |
| handleBrokenSinkChannel | back to summary |
|---|---|
| protected void handleBrokenSinkChannel(Throwable e) Implements abstract io. Doc from io. Method that is invoked when then write side of a channel is broken. This generally happens on a protocol error.
| |
| handleBrokenSourceChannel | back to summary |
|---|---|
| protected void handleBrokenSourceChannel(Throwable e) Implements abstract io. Doc from io. Method that is invoked when the read side of the channel is broken. This generally happens on a protocol error.
| |
| isClient | back to summary |
|---|---|
| public boolean isClient() | |
| isCloseFrameReceived | back to summary |
|---|---|
| public boolean isCloseFrameReceived() | |
| isCloseFrameSent | back to summary |
|---|---|
| public boolean isCloseFrameSent() | |
| isCloseInitiatedByRemotePeer | back to summary |
|---|---|
| public boolean isCloseInitiatedByRemotePeer() If this is true the session is being closed because the remote peer sent a close frame
| |
| isLastFrameReceived | back to summary |
|---|---|
| protected boolean isLastFrameReceived() Implements abstract io. Doc from io. Returns true if the protocol specific final frame has been received.
| |
| isLastFrameSent | back to summary |
|---|---|
| protected boolean isLastFrameSent() Implements abstract io.
| |
| isReadsBroken | back to summary |
|---|---|
| protected boolean isReadsBroken() Overrides io. | |
| isSecure | back to summary |
|---|---|
| public boolean isSecure() Return | |
| lastDataRead | back to summary |
|---|---|
| protected void lastDataRead() Overrides io. Doc from io. Method than is invoked when read() returns -1.
| |
| markReadsBroken | back to summary |
|---|---|
| protected void markReadsBroken(Throwable cause) Overrides io. Doc from io. 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. | |
| parseFrame | back to summary |
|---|---|
| protected FrameHeaderData parseFrame(ByteBuffer data) throws IOException Implements abstract io. Doc from io. Attempts to parse an incoming frame header from the data in the buffer.
| |
| receiveFrame | back to summary |
|---|---|
| protected abstract WebSocketChannel. Create a new
| |
| send | back to summary |
|---|---|
| public final StreamSinkFrameChannel send(WebSocketFrameType type) throws IOException Returns a new
| |
| sendClose | back to summary |
|---|---|
| public void sendClose() throws IOException Send a Close frame without a payload | |
| setAttribute | back to summary |
|---|---|
| public final boolean setAttribute(String key, Object value) | |
| setCloseCode | back to summary |
|---|---|
| public void setCloseCode(int closeCode) | |
| setCloseReason | back to summary |
|---|---|
| public void setCloseReason(String closeReason) | |
| Modifier and Type | Method and Description |
|---|---|
| public StreamSourceFrameChannel | Returns: The channel, or null if the channel is not available yet
|
| public void | |
| public boolean |
| getChannel | back to summary |
|---|---|
public StreamSourceFrameChannel getChannel(final PooledByteBuffer data)
| |
| handle | back to summary |
|---|---|
| public void handle(ByteBuffer data) throws WebSocketException Handles the data, any remaining data will be pushed back | |
| isDone | back to summary |
|---|---|
public boolean isDone()
| |