public class WebSocketProxy extends Object implements okhttp3.ws.WebSocketListener
| Modifier and Type | Field and Description |
|---|---|
protected ArtikCloudWebSocketCallback |
callback |
protected okhttp3.OkHttpClient |
client |
protected CountDownLatch |
closeSignal |
protected static String |
host |
protected JSON |
json |
protected CountDownLatch |
openSignal |
protected okhttp3.Request |
request |
protected ScheduledExecutorService |
scheduler |
protected ConnectionStatus |
status |
protected okhttp3.ws.WebSocket |
webSocket |
| Constructor and Description |
|---|
WebSocketProxy(String url,
okhttp3.OkHttpClient client,
ArtikCloudWebSocketCallback callback) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
asString(Throwable exc) |
void |
close() |
void |
closeBlocking() |
void |
connect() |
void |
connectBlocking() |
ConnectionStatus |
getConnectionStatus() |
void |
onClose(int code,
String reason) |
void |
onFailure(IOException exc,
okhttp3.Response response) |
void |
onMessage(okhttp3.ResponseBody response) |
void |
onOpen(okhttp3.ws.WebSocket webSocket,
okhttp3.Response response) |
void |
onPong(okio.Buffer arg0) |
protected void |
sendObject(Object object) |
static void |
setHost(String host) |
protected okhttp3.Request request
protected okhttp3.ws.WebSocket webSocket
protected ArtikCloudWebSocketCallback callback
protected okhttp3.OkHttpClient client
protected final JSON json
protected final ScheduledExecutorService scheduler
protected ConnectionStatus status
protected CountDownLatch openSignal
protected CountDownLatch closeSignal
protected static String host
public WebSocketProxy(String url, okhttp3.OkHttpClient client, ArtikCloudWebSocketCallback callback)
public static void setHost(String host)
public ConnectionStatus getConnectionStatus()
public final void onOpen(okhttp3.ws.WebSocket webSocket,
okhttp3.Response response)
public final void onClose(int code,
String reason)
public final void onFailure(IOException exc, okhttp3.Response response)
public void onMessage(okhttp3.ResponseBody response)
throws IOException
public final void onPong(okio.Buffer arg0)
public final void connect()
throws IOException
public final void connectBlocking()
throws IOException,
InterruptedException
public final void close()
throws IOException
public final void closeBlocking()
throws IOException,
InterruptedException
protected void sendObject(Object object) throws IOException
Copyright © 2018. All rights reserved.