本文整理汇总了Java中okhttp3.ws.WebSocketCall.enqueue方法的典型用法代码示例。如果您正苦于以下问题:Java WebSocketCall.enqueue方法的具体用法?Java WebSocketCall.enqueue怎么用?Java WebSocketCall.enqueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类okhttp3.ws.WebSocketCall
的用法示例。
在下文中一共展示了WebSocketCall.enqueue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import okhttp3.ws.WebSocketCall; //导入方法依赖的package包/类
public void connect() {
if (mClosed) {
throw new IllegalStateException("Can't connect closed client");
}
OkHttpClient httpClient = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(0, TimeUnit.MINUTES) // Disable timeouts for read
.build();
Request request = new Request.Builder().url(mUrl).build();
WebSocketCall call = WebSocketCall.create(httpClient, request);
call.enqueue(this);
}
示例2: connect
import okhttp3.ws.WebSocketCall; //导入方法依赖的package包/类
public void connect(String url, JSDebuggerCallback callback) {
if (mHttpClient != null) {
throw new IllegalStateException("JSDebuggerWebSocketClient is already initialized.");
}
mConnectCallback = callback;
mHttpClient = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(0, TimeUnit.MINUTES) // Disable timeouts for read
.build();
Request request = new Request.Builder().url(url).build();
WebSocketCall call = WebSocketCall.create(mHttpClient, request);
call.enqueue(this);
}
示例3: connect
import okhttp3.ws.WebSocketCall; //导入方法依赖的package包/类
public void connect() {
if (mClosed) {
throw new IllegalStateException("Can't connect closed client");
}
OkHttpClient httpClient = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(0, TimeUnit.MINUTES) // Disable timeouts for read
.build();
Request request = new Request.Builder().url(mUrl).build();
WebSocketCall call = WebSocketCall.create(httpClient, request);
call.enqueue(this);
}
示例4: connect
import okhttp3.ws.WebSocketCall; //导入方法依赖的package包/类
public final void connect() throws IOException {
if (this.status != ConnectionStatus.CONNECTING) {
this.status = ConnectionStatus.CONNECTING;
WebSocketCall ws = WebSocketCall.create(this.client, this.request);
ws.enqueue(this);
}
}
示例5: connect
import okhttp3.ws.WebSocketCall; //导入方法依赖的package包/类
public void connect() {
if (mClosed) {
throw new IllegalStateException("Can't connect closed client");
}
OkHttpClient httpClient = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(0, TimeUnit.MINUTES) // Disable timeouts for read
.build();
Request request = new Request.Builder().url(mUrl).build();
WebSocketCall call = WebSocketCall.create(httpClient, request);
call.enqueue(this);
}
示例6: CliWebSocketListener
import okhttp3.ws.WebSocketCall; //导入方法依赖的package包/类
public CliWebSocketListener(OkHttpClient httpClient, WebSocketCall wsc, Config config) {
this.httpClient = httpClient;
this.config = config;
wsc.enqueue(this);
}