如何是AndroidAsync的WebSockets设置超时? [英] How are timeouts set for AndroidAsync websockets?

查看:2026
本文介绍了如何是AndroidAsync的WebSockets设置超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图更改默认AndroidAsync的WebSocket 30秒初始连接超时。这是默认的超时工作版本:

I am trying to change the default AndroidAsync websocket initial connection timeout of 30 seconds. This is the working version with the default timeout:

AsyncHttpClient.getDefaultInstance().websocket(connectionURI.toString(), null, this);

我想更改超时。这是我所期待的工作:

I would like to change the timeout. This is what I expected to work:

int timeout_ms = 20000;
AsyncHttpGet request = new AsyncHttpGet(connectionURI.toString());
request.setTimeout(timeout_ms);
AsyncHttpClient.getDefaultInstance().websocket(request, null, this);

这将导致一个 java.lang.IllegalArgumentException异常:无效的URI = WS://exampleserver.com:80 /测试中间件= [com.koushikdutta.async.http.HttpTransportMiddleware@1e2543c8,融为一体。 koushikdutta.async.http.spdy.SpdyMiddleware@2534fc61,com.koushikdutta.async.http.AsyncSocketMiddleware@107b3386]

注意完全相同connectionURI串是成功的第一种情况下,而不是第二个。

Note that exactly the same connectionURI string is successful in the first case, but not the second.

有没有办法来改变AndroidAsync的WebSocket的超时?

Is there a way to change the timeout of the AndroidAsync websocket?

推荐答案

这似乎是Koush悬而未决的问题
https://github.com/koush/AndroidAsync/issues/340

It seems to be unresolved issue by Koush https://github.com/koush/AndroidAsync/issues/340

这篇关于如何是AndroidAsync的WebSockets设置超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆