本文整理了Java中okhttp3.WebSocket.cancel()
方法的一些代码示例,展示了WebSocket.cancel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebSocket.cancel()
方法的具体详情如下:
包路径:okhttp3.WebSocket
类名称:WebSocket
方法名:cancel
[英]Immediately and violently release resources held by this web socket, discarding any enqueued messages. This does nothing if the web socket has already been closed or canceled.
[中]
代码示例来源:origin: amitshekhariitbhu/Fast-Android-Networking
private void disconnectWebSocket() {
if (webSocket != null) {
webSocket.cancel();
}
}
代码示例来源:origin: openshift/openshift-restclient-java
@Override
public void stop() {
if (call != null) {
call.cancel();
} else {
shouldStop = true;
}
}
代码示例来源:origin: com.openshift/openshift-restclient-java
@Override
public void stop() {
if (call != null) {
call.cancel();
} else {
shouldStop = true;
}
}
代码示例来源:origin: fedepaol/websocket-sample
public void disconnect() {
mWebSocket.cancel();
mListener = null;
mMessageHandler.removeCallbacksAndMessages(null);
mStatusHandler.removeCallbacksAndMessages(null);
}
代码示例来源:origin: openshift/openshift-restclient-java
@Override
public void onOpen(WebSocket webSocket, Response response) {
if (open.compareAndSet(false, true)) {
this.call = webSocket;
listener.onOpen();
if (shouldStop) {
webSocket.cancel();
}
}
}
代码示例来源:origin: com.openshift/openshift-restclient-java
@Override
public void onOpen(WebSocket webSocket, Response response) {
if (open.compareAndSet(false, true)) {
this.call = webSocket;
listener.onOpen();
if (shouldStop) {
webSocket.cancel();
}
}
}
代码示例来源:origin: radixdlt/radixdlt-java
public boolean close() {
if (messages.hasObservers()) {
return false;
}
if (this.webSocket != null) {
this.status.onNext(RadixClientStatus.CLOSING);
this.webSocket.cancel();
}
return true;
}
内容来源于网络,如有侵权,请联系作者删除!