Top Constructors Methods
io.undertow.websockets.core

public Class WebSockets

extends Object
Class Inheritance
Imports
io.undertow.connector.PooledByteBuffer, io.undertow.util.ImmediatePooledByteBuffer, .WorkerUtils, org.xnio.Buffers, .ChannelExceptionHandler, .ChannelListener, .IoUtils, .XnioExecutor, java.io.IOException, java.nio.ByteBuffer, java.nio.charset.StandardCharsets, java.util.concurrent.TimeUnit

Author
Stuart Douglas

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static <T> void
flushChannelAsync(final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, StreamSinkFrameChannel channel, final T context, long timeoutmillis)

public static ByteBuffer
public static void
sendBinary(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete binary message, invoking the callback when complete

public static <T> void
sendBinary(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete binary message, invoking the callback when complete

public static void
sendBinary(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete binary message, invoking the callback when complete

public static <T> void
sendBinary(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete binary message, invoking the callback when complete

public static void
sendBinary(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete binary message, invoking the callback when complete

public static <T> void
sendBinary(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete binary message, invoking the callback when complete

public static void
sendBinary(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete binary message, invoking the callback when complete

public static <T> void
sendBinary(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete binary message, invoking the callback when complete

public static void
sendBinary(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete binary message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static <T> void
sendBinary(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete binary message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static void
sendBinary(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete binary message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static <T> void
sendBinary(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete binary message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static void
sendBinaryBlocking(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete binary message using blocking IO

public static void
sendBinaryBlocking(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete binary message using blocking IO

public static void
sendBinaryBlocking(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete binary message using blocking IO Automatically frees the pooled byte buffer when done.

private static void
private static void
public static void
sendClose(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete close message, invoking the callback when complete

public static <T> void
sendClose(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete close message, invoking the callback when complete

public static void
sendClose(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete close message, invoking the callback when complete

public static <T> void
sendClose(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete close message, invoking the callback when complete

public static void
sendClose(final int
The close code
code
,
String reason, final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete close message, invoking the callback when complete

public static <T> void
sendClose(final int
The close code
code
,
String reason, final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete close message, invoking the callback when complete

public static void
sendClose(final CloseMessage
The close message
closeMessage
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete close message, invoking the callback when complete

public static <T> void
sendClose(final CloseMessage
The close message
closeMessage
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete close message, invoking the callback when complete

public static void
sendCloseBlocking(final CloseMessage
the close message
closeMessage
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete close message, invoking the callback when complete

public static void
sendCloseBlocking(final int code, String reason, final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete close message, invoking the callback when complete

public static void
sendCloseBlocking(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete close message, invoking the callback when complete

public static void
sendCloseBlocking(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete close message, invoking the callback when complete

private static <T> void
sendInternal(final ByteBuffer data, WebSocketFrameType type, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis)

private static <T> void
sendInternal(final PooledByteBuffer pooledData, WebSocketFrameType type, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis)

public static void
sendPing(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete ping message, invoking the callback when complete

public static <T> void
sendPing(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete ping message, invoking the callback when complete

public static void
sendPing(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete ping message, invoking the callback when complete

public static <T> void
sendPing(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete ping message, invoking the callback when complete

public static void
sendPing(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete ping message, invoking the callback when complete

public static <T> void
sendPing(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete ping message, invoking the callback when complete

public static void
sendPing(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete ping message, invoking the callback when complete

public static <T> void
sendPing(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete ping message, invoking the callback when complete

public static void
sendPing(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete ping message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static <T> void
sendPing(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete ping message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static void
sendPing(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete ping message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static <T> void
sendPing(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete ping message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static void
sendPingBlocking(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete ping message using blocking IO

public static void
sendPingBlocking(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete ping message using blocking IO

public static void
sendPingBlocking(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete ping message using blocking IO Automatically frees the pooled byte buffer when done.

public static void
sendPong(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete pong message, invoking the callback when complete

public static <T> void
sendPong(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete pong message, invoking the callback when complete

public static void
sendPong(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete pong message, invoking the callback when complete

public static <T> void
sendPong(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete pong message, invoking the callback when complete

public static void
sendPong(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete pong message, invoking the callback when complete

public static <T> void
sendPong(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete pong message, invoking the callback when complete

public static void
sendPong(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete pong message, invoking the callback when complete

public static <T> void
sendPong(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete pong message, invoking the callback when complete

public static void
sendPong(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete pong message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static <T> void
sendPong(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete pong message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static void
sendPong(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete pong message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static <T> void
sendPong(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete pong message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static void
sendPongBlocking(final ByteBuffer
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete pong message using blocking IO

public static void
sendPongBlocking(final ByteBuffer[]
The data to send
data
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete pong message using blocking IO

public static void
sendPongBlocking(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete pong message using blocking IO Automatically frees the pooled byte buffer when done.

public static void
sendText(final String
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete text message, invoking the callback when complete

public static <T> void
sendText(final String
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete text message, invoking the callback when complete

public static void
sendText(final String
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete text message, invoking the callback when complete

public static <T> void
sendText(final String
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete text message, invoking the callback when complete

public static void
sendText(final ByteBuffer
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete text message, invoking the callback when complete

public static <T> void
sendText(final ByteBuffer
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete text message, invoking the callback when complete

public static void
sendText(final ByteBuffer
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete text message, invoking the callback when complete

public static <T> void
sendText(final ByteBuffer
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete text message, invoking the callback when complete

public static void
sendText(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
)

Sends a complete text message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static <T> void
sendText(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
)

Sends a complete text message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static void
sendText(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<Void>
The callback to invoke on completion
callback
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete text message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static <T> void
sendText(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
,
final WebSocketCallback<T>
The callback to invoke on completion
callback
,
T
The context object that will be passed to the callback on completion
context
,
long
the timeout in milliseconds
timeoutmillis
)

Sends a complete text message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

public static void
sendTextBlocking(final String
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete text message, invoking the callback when complete

public static void
sendTextBlocking(final ByteBuffer
The text to send
message
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete text message, invoking the callback when complete

public static void
sendTextBlocking(final PooledByteBuffer
The data to send, it will be freed when done
pooledData
,
final WebSocketChannel
The web socket channel
wsChannel
)

Sends a complete text message, invoking the callback when complete Automatically frees the pooled byte buffer when done.

private static void
setupTimeout(final StreamSinkFrameChannel channel, long timeoutmillis)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait