问题描述
我试图更改默认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悬而未决的问题
It seems to be unresolved issue by Koushhttps://github.com/koush/AndroidAsync/issues/340
这篇关于如何是AndroidAsync的WebSockets设置超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!