public class WebSocketUpgradeHandler extends Object implements UpgradeHandler<WebSocket>, AsyncHandler<WebSocket>
AsyncHandler
which is able to execute WebSocket upgrade. Use the Builder for configuring WebSocket options.Modifier and Type | Class and Description |
---|---|
static class |
WebSocketUpgradeHandler.Builder
Build a
WebSocketUpgradeHandler |
AsyncHandler.State
Constructor and Description |
---|
WebSocketUpgradeHandler(List<WebSocketListener> listeners) |
Modifier and Type | Method and Description |
---|---|
void |
bufferFrame(Runnable bufferedFrame) |
AsyncHandler.State |
onBodyPartReceived(HttpResponseBodyPart bodyPart)
Invoked as soon as some response body part are received.
|
void |
onClose(WebSocket webSocket,
int status,
String reasonPhrase) |
WebSocket |
onCompleted()
Invoked once the HTTP response processing is finished.
|
void |
onFailure(Throwable t)
If the upgrade fail.
|
AsyncHandler.State |
onHeadersReceived(HttpResponseHeaders headers)
Invoked as soon as the HTTP headers has been received.
|
AsyncHandler.State |
onStatusReceived(HttpResponseStatus responseStatus)
Invoked as soon as the HTTP status line has been received
|
void |
onSuccess(WebSocket webSocket)
If the HTTP Upgrade succeed (response's status code equals 101), the
AsyncHttpClient will invoke that method. |
void |
onThrowable(Throwable t)
Invoked when an unexpected exception occurs during the processing of the response.
|
boolean |
touchSuccess() |
public WebSocketUpgradeHandler(List<WebSocketListener> listeners)
public void bufferFrame(Runnable bufferedFrame)
public final void onThrowable(Throwable t)
onThrowable
in interface AsyncHandler<WebSocket>
t
- a Throwable
public boolean touchSuccess()
public final AsyncHandler.State onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception
onBodyPartReceived
in interface AsyncHandler<WebSocket>
bodyPart
- response's body part.AsyncHandler.State
telling to CONTINUE or ABORT the current processing. Aborting will also close the connection.Exception
- if something wrong happenspublic final AsyncHandler.State onStatusReceived(HttpResponseStatus responseStatus) throws Exception
onStatusReceived
in interface AsyncHandler<WebSocket>
responseStatus
- the status code and test of the responseAsyncHandler.State
telling to CONTINUE or ABORT the current processing.Exception
- if something wrong happenspublic final AsyncHandler.State onHeadersReceived(HttpResponseHeaders headers) throws Exception
onHeadersReceived
in interface AsyncHandler<WebSocket>
headers
- the HTTP headers.AsyncHandler.State
telling to CONTINUE or ABORT the current processing.Exception
- if something wrong happenspublic final WebSocket onCompleted() throws Exception
onCompleted
in interface AsyncHandler<WebSocket>
Future
Exception
- if something wrong happenspublic final void onSuccess(WebSocket webSocket)
AsyncHttpClient
will invoke that method.onSuccess
in interface UpgradeHandler<WebSocket>
webSocket
- an Upgradable entitypublic final void onFailure(Throwable t)
onFailure
in interface UpgradeHandler<WebSocket>
t
- a Throwable
Copyright © 2016. All Rights Reserved.