public class ServerWebSocketImpl extends WebSocketImplBase<ServerWebSocketImpl> implements ServerWebSocket
closed| Modifier and Type | Method and Description |
|---|---|
void |
accept()
Accept the WebSocket and terminate the WebSocket handshake.
|
void |
close()
Close the WebSocket sending the default close frame.
|
String |
path() |
X509Certificate[] |
peerCertificateChain()
Note: Java SE 5+ recommends to use javax.net.ssl.SSLSession#getPeerCertificates() instead of
of javax.net.ssl.SSLSession#getPeerCertificateChain() which this method is based on.
|
String |
query() |
void |
reject()
Reject the WebSocket.
|
void |
reject(int sc)
Like
ServerWebSocket.reject() but with a status. |
void |
setHandshake(Future<Integer> future)
Like
ServerWebSocket.setHandshake(Future, Handler) but without a completion handler. |
void |
setHandshake(Future<Integer> future,
Handler<AsyncResult<Integer>> handler)
Set an asynchronous result for the handshake, upon completion of the specified
future, the
WebSocket will either be
accepted when the future succeeds with the HTTP 101 status code
rejected when the future is succeeds with an HTTP status code different than 101
rejected when the future fails with the HTTP status code 500
The provided future might be completed by the WebSocket itself, e.g calling the ServerWebSocket.close() method
will try to accept the handshake and close the WebSocket afterward. |
SSLSession |
sslSession() |
String |
uri() |
ServerWebSocketImpl |
writeFrame(WebSocketFrame frame,
Handler<AsyncResult<Void>> handler)
Same as
WebSocketBase.writeFrame(WebSocketFrame) but with an handler called when the operation completes |
binaryHandlerID, binaryMessageHandler, close, close, close, close, close, closeHandler, closeReason, closeStatusCode, drainHandler, end, end, endHandler, exceptionHandler, fetch, frameHandler, handler, headers, isClosed, isSsl, localAddress, pause, pongHandler, remoteAddress, resume, setWriteQueueMaxSize, subProtocol, textHandlerID, textMessageHandler, write, write, writeBinaryMessage, writeBinaryMessage, writeFinalBinaryFrame, writeFinalBinaryFrame, writeFinalTextFrame, writeFinalTextFrame, writeFrame, writePing, writePong, writeQueueFull, writeTextMessage, writeTextMessageclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseHandler, drainHandler, endHandler, exceptionHandler, fetch, frameHandler, handler, pause, resume, setWriteQueueMaxSize, write, write, writeBinaryMessage, writeBinaryMessage, writeFinalBinaryFrame, writeFinalBinaryFrame, writeFinalTextFrame, writeFinalTextFrame, writeFrame, writeTextMessage, writeTextMessagebinaryHandlerID, binaryMessageHandler, close, close, close, close, close, closeReason, closeStatusCode, end, end, headers, isClosed, isSsl, localAddress, pongHandler, remoteAddress, subProtocol, textHandlerID, textMessageHandler, writePing, writePongpipe, pipeTo, pipeToend, end, writeQueueFullpublic String uri()
uri in interface ServerWebSocketpublic String path()
path in interface ServerWebSocketpublic String query()
query in interface ServerWebSocketpublic void accept()
ServerWebSocketaccept in interface ServerWebSocketpublic void reject()
ServerWebSocketCalling this method from the WebSocket handler when it is first passed to you gives you the opportunity to reject the WebSocket, which will cause the WebSocket handshake to fail by returning a 502 response code.
You might use this method, if for example you only want to accept WebSockets with a particular path.
reject in interface ServerWebSocketpublic void reject(int sc)
ServerWebSocketServerWebSocket.reject() but with a status.reject in interface ServerWebSocketpublic SSLSession sslSession()
sslSession in interface ServerWebSocketsslSession in interface WebSocketBasesslSession in class WebSocketImplBase<ServerWebSocketImpl>SSLSessionpublic X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException
WebSocketBaseWebSocketBase.sslSession() to
access that method.peerCertificateChain in interface ServerWebSocketpeerCertificateChain in interface WebSocketBasepeerCertificateChain in class WebSocketImplBase<ServerWebSocketImpl>SSLPeerUnverifiedException - SSL peer's identity has not been verified.SSLSession.getPeerCertificateChain(),
WebSocketBase.sslSession()public void close()
WebSocketBaseclose in interface ServerWebSocketclose in interface WebSocketBaseclose in class WebSocketImplBase<ServerWebSocketImpl>public ServerWebSocketImpl writeFrame(WebSocketFrame frame, Handler<AsyncResult<Void>> handler)
WebSocketBaseWebSocketBase.writeFrame(WebSocketFrame) but with an handler called when the operation completeswriteFrame in interface ServerWebSocketwriteFrame in interface WebSocketBasewriteFrame in class WebSocketImplBase<ServerWebSocketImpl>public void setHandshake(Future<Integer> future)
ServerWebSocketServerWebSocket.setHandshake(Future, Handler) but without a completion handler.setHandshake in interface ServerWebSocketpublic void setHandshake(Future<Integer> future, Handler<AsyncResult<Integer>> handler)
ServerWebSocketfuture, the
WebSocket will either be
future succeeds with the HTTP 101 status codefuture is succeeds with an HTTP status code different than 101future fails with the HTTP status code 500ServerWebSocket.close() method
will try to accept the handshake and close the WebSocket afterward. Thus it is advised to try to complete
the future with Promise.tryComplete(T) or Promise.tryFail(java.lang.Throwable).
This method should be called from the WebSocket handler to explicitly set an asynchronous handshake.
Calling this method will override the future completion handler.
setHandshake in interface ServerWebSocketfuture - the future to complete withhandler - the completion handlerCopyright © 2020. All rights reserved.