当我通过 Wi-Fi 连接到套接字时,一切正常,这是 Logger 日志:2018-11-01 11:54:44.395 : io.socket.client.IO: ignoring socket cache for http://myserverexample.com:80/2018-11-01 11:54:44.402 : io.socket.client.Manager: readyState CLOSED2018-11-01 11:54:44.405 : io.socket.client.Manager: opening http://myserverexample.com:80/2018-11-01 11:54:44.408 : io.socket.client.Manager: connection attempt will timeout after 200002018-11-01 11:54:44.411 : .socket.engineio.client.Socket: creating transport 'polling'2018-11-01 11:54:44.413 : .socket.engineio.client.Socket: setting transport polling2018-11-01 11:54:44.415 : neio.client.transports.Polling: polling2018-11-01 11:54:44.417 : o.client.transports.PollingXHR: xhr poll2018-11-01 11:54:44.421 : o.client.transports.PollingXHR: xhr open GET: http://myserverexample.com/socket.io/?EIO=3&transport=polling2018-11-01 11:54:44.423 : o.client.transports.PollingXHR: sending xhr with url http://myserverexample.com/socket.io/?EIO=3&transport=polling | data null但是当我尝试通过移动互联网轮询连接时,得到的数据如下 xml:neio.client.transports.Polling: polling got data <?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"><wml><card id="FEHLER" title="ERROR"><p>The requested item could not be loaded <br/>Wrong MIME-Type<do type="prev" label="back"><prev/></do></p></card></wml>然后我收到mSocket.on(Socket.EVENT_CONNECT_ERROR, new Emitter.Listener() { @Override public void call(Object... args) { if (args.length> 0 && args[0] instanceof EngineIOException){ ((EngineIOException)args[0]).printStackTrace(); } } });
1 回答
富国沪深
TA贡献1790条经验 获得超9个赞
Fehler(错误)6 - 无法加载请求的项目
一些移动运营商拦截客户端请求,如果 Content-Type 不好,或者没有定义,他们会显示这样的页面。
所以为了解决这个问题,我将服务器从HTTP
改为HTTPS
从
Socket mSocket = IO.socket("http://myserverexample.com/", opts);
到
Socket mSocket = IO.socket("https://myserverexample.com/", opts);
添加回答
举报
0/150
提交
取消