public class WebSocketTransport extends com.ning.http.client.ws.WebSocketUpgradeHandler implements Transport
Transport
implementationModifier and Type | Field and Description |
---|---|
protected boolean |
protocolEnabled |
protected boolean |
protocolReceived |
protected boolean |
supportBinary |
protected ScheduledExecutorService |
timer |
Constructor and Description |
---|
WebSocketTransport(com.ning.http.client.RequestBuilder requestBuilder,
Options options,
Request request,
List<FunctionWrapper> functions) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the underlying transport}
|
void |
connectedFuture(Future f)
Set the
Future , which will unlock the Socket.fire(java.lang.Object) method once the connection has been fully established. |
void |
error(Throwable t)
Set a
Throwable |
boolean |
errorHandled()
Error handled by a
Function |
void |
future(Future f)
Set the
Future , which can be used to clone the connection. |
Request.TRANSPORT |
name()
The transport name
|
com.ning.http.client.AsyncHandler.STATE |
onBodyPartReceived(com.ning.http.client.HttpResponseBodyPart bodyPart) |
com.ning.http.client.ws.WebSocket |
onCompleted() |
void |
onFailure(Throwable t) |
com.ning.http.client.AsyncHandler.STATE |
onHeadersReceived(com.ning.http.client.HttpResponseHeaders headers) |
com.ning.http.client.AsyncHandler.STATE |
onStatusReceived(com.ning.http.client.HttpResponseStatus responseStatus) |
void |
onSuccess(com.ning.http.client.ws.WebSocket webSocket) |
void |
onThrowable(Throwable t)
Called when an unexpected exception ocurred.
|
Transport |
registerF(FunctionWrapper function)
Register a new
FunctionResolver |
WebSocketTransport |
sendMessage(byte[] message) |
WebSocketTransport |
sendMessage(String message) |
Socket.STATUS |
status()
Return the current
Socket.STATUS |
protected final boolean protocolEnabled
protected boolean supportBinary
protected final ScheduledExecutorService timer
protected boolean protocolReceived
public WebSocketTransport(com.ning.http.client.RequestBuilder requestBuilder, Options options, Request request, List<FunctionWrapper> functions)
public void onThrowable(Throwable t)
onThrowable
in interface com.ning.http.client.AsyncHandler<com.ning.http.client.ws.WebSocket>
onThrowable
in interface Transport
onThrowable
in class com.ning.http.client.ws.WebSocketUpgradeHandler
t
- a Throwable
public void close()
public Socket.STATUS status()
Socket.STATUS
public boolean errorHandled()
Function
errorHandled
in interface Transport
public void connectedFuture(Future f)
Transport
Future
, which will unlock the Socket.fire(java.lang.Object)
method once the connection has been fully established.connectedFuture
in interface Transport
f
- Future
public com.ning.http.client.AsyncHandler.STATE onBodyPartReceived(com.ning.http.client.HttpResponseBodyPart bodyPart) throws Exception
onBodyPartReceived
in interface com.ning.http.client.AsyncHandler<com.ning.http.client.ws.WebSocket>
onBodyPartReceived
in class com.ning.http.client.ws.WebSocketUpgradeHandler
Exception
public com.ning.http.client.AsyncHandler.STATE onStatusReceived(com.ning.http.client.HttpResponseStatus responseStatus) throws Exception
onStatusReceived
in interface com.ning.http.client.AsyncHandler<com.ning.http.client.ws.WebSocket>
onStatusReceived
in class com.ning.http.client.ws.WebSocketUpgradeHandler
Exception
public com.ning.http.client.AsyncHandler.STATE onHeadersReceived(com.ning.http.client.HttpResponseHeaders headers) throws Exception
onHeadersReceived
in interface com.ning.http.client.AsyncHandler<com.ning.http.client.ws.WebSocket>
onHeadersReceived
in class com.ning.http.client.ws.WebSocketUpgradeHandler
Exception
public com.ning.http.client.ws.WebSocket onCompleted() throws Exception
onCompleted
in interface com.ning.http.client.AsyncHandler<com.ning.http.client.ws.WebSocket>
onCompleted
in class com.ning.http.client.ws.WebSocketUpgradeHandler
Exception
public void onSuccess(com.ning.http.client.ws.WebSocket webSocket)
onSuccess
in interface com.ning.http.client.UpgradeHandler<com.ning.http.client.ws.WebSocket>
onSuccess
in class com.ning.http.client.ws.WebSocketUpgradeHandler
public Request.TRANSPORT name()
public Transport registerF(FunctionWrapper function)
FunctionResolver
registerF
in interface Transport
function
- FunctionResolver
public final void onFailure(Throwable t)
onFailure
in interface com.ning.http.client.UpgradeHandler<com.ning.http.client.ws.WebSocket>
onFailure
in class com.ning.http.client.ws.WebSocketUpgradeHandler
public WebSocketTransport sendMessage(String message)
public WebSocketTransport sendMessage(byte[] message)
Copyright © 2015. All Rights Reserved.