我在這裏看到類似的失敗報告:https://groups.google.com/forum/?fromgroups=#!topic/sockjs/QNtA1_p_arU,但我的問題似乎有所不同。SockJS與IE9有問題
我的設置:客戶端連接到SockJS的https://www.mysite.com/sockjs
,並且實際頁面在https://www.mysite.com/blah/blah/blah
處提供。頁面上的所有外部元素(例如css和js)都與https一起提供,其中包括SockJS客戶端(https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.js,最新版本應爲0.3.4 )。後端由SockJS-Tornado製成。
問題1:我指定以下協議來使用:
var options = {protocols_whitelist: ["websocket", "xhr-streaming", "xdr-streaming", "xhr-polling", "xdr-polling", "iframe-htmlfile", "iframe-eventsource", "iframe-xhr-polling"], debug: true};
conn = new SockJS("https://www.mysite.com/sockjs", options);
然而,似乎IE9只需使用最壞可能的協議iframe-htmlfile
,因爲我看到在服務器日誌如下:
INFO:root:200 GET /sockjs/info?t=1353062888578 (127.0.0.1) 0.51ms
INFO:root:200 GET /sockjs/iframe.html (127.0.0.1) 22.21ms
爲什麼不使用xdr-streaming
或xdr-polling
?在SockJS文檔中,它在'IE8,9(cookies = no)'下標記這兩個協議,這是否意味着SockJS只會在瀏覽器禁用Cookie時才使用它們?
問題2:與使用協議iframe-htmlfile
的,用戶將得到的頁面,這標誌着一個混合內容問題上的'Only Secure Content is Displayed'
警告。但是,沒有其他測試過的瀏覽器會報告此警告(例如Chrome,FireFox,Safari),如前所述,頁面上的每個外部資源都通過https提供服務。爲什麼是這樣?它是否與此特定協議iframe-htmlfile
有關?
與此同時,SockJS努力連接到服務器併發送消息。這是我在服務器日誌中看到的:
INFO:root:200 GET /sockjs/info?t=1353062888578 (127.0.0.1) 0.51ms
INFO:root:200 GET /sockjs/iframe.html (127.0.0.1) 22.21ms
INFO:root:200 GET /sockjs/info?t=1353062922712 (127.0.0.1) 0.39ms
connection openned for: 127.0.0.1
INFO:root:200 GET /sockjs/info?t=1353062963868 (127.0.0.1) 0.36ms
WARNING:root:Read error on 12: [Errno 104] Connection reset by peer
WARNING:root:error on read
Traceback (most recent call last):
File "/home/ml/envs/.virtualenvs/sockapp/local/lib/python2.7/site-packages/tornado/iostream.py", line 355, in _handle_read
if self._read_to_buffer() == 0:
File "/home/ml/envs/.virtualenvs/sockapp/local/lib/python2.7/site-packages/tornado/iostream.py", line 422, in _read_to_buffer
chunk = self._read_from_socket()
File "/home/ml/envs/.virtualenvs/sockapp/local/lib/python2.7/site-packages/tornado/iostream.py", line 403, in _read_from_socket
chunk = self.socket.recv(self.read_chunk_size)
error: [Errno 104] Connection reset by peer
subject disconnection from: None
Message handled in: 0 ms
INFO:root:200 GET /sockjs/369/rpf1d1vl/htmlfile?c=_jp.aepnvri (127.0.0.1) 60006.30ms
最後一個錯誤似乎是超時。當我關閉IE9中的警告對話框時,連接似乎打開,但之後沒有從瀏覽器接收到消息(瀏覽器在連接打開後應該立即發送消息)。我想知道這是否與之前的混合內容警告有關。