为什么轮询在 SocketIO 上获得数据“无法加载请求的项目”?

当我通过 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 CLOSED

2018-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 20000

2018-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 polling

2018-11-01 11:54:44.415 : neio.client.transports.Polling: polling

2018-11-01 11:54:44.417 : o.client.transports.PollingXHR: xhr poll

2018-11-01 11:54:44.421 : o.client.transports.PollingXHR: xhr open GET: http://myserverexample.com/socket.io/?EIO=3&transport=polling

2018-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();

                    }

               }

            });


MMTTMM
浏览 139回答 1
1回答

富国沪深

Fehler(错误)6 - 无法加载请求的项目一些移动运营商拦截客户端请求,如果 Content-Type 不好,或者没有定义,他们会显示这样的页面。所以为了解决这个问题,我将服务器从HTTP改为HTTPS从Socket&nbsp;mSocket&nbsp;=&nbsp;IO.socket("http://myserverexample.com/",&nbsp;opts);到Socket&nbsp;mSocket&nbsp;=&nbsp;IO.socket("https://myserverexample.com/",&nbsp;opts);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java