我想調用一個外部websocket服務器,但它不工作,我有錯誤:nonzero hanshake。Websocket,標題和排名
我在c#應用程序中使用superwebsocket的客戶端。
我比較了(使用wireShark)我發送的例子誰工作(但在JavaScript),我看到唯一的區別是在標題中的字段的排名。
可能是我的問題的原因?我應該尊重領域的排名嗎?
PS:
GET/HTTP/1.1
Host: 127.0.0.1:8080
Origin: null
Sec-WebSocket-Key1: 3O45 82 4 ;Q 0 376
Connection: Upgrade
Sec-WebSocket-Key2: <361 6 W 12 Z152
Upgrade: WebSocket
Sec-WebSocket-Protocol: myProtocol
感謝:我在這個順序
GET/HTTP/1.1
Upgrade: WebSocket
Connection: Up grade
Sec-WebSocket-Key1: DC1M 5VEEm 731
Sec-WebSocket-Key2: 7 tQG6 7540Q226
Host: 127.0.0.1
Origin: 127.0.0.1
Sec-WebSocket-Protocol: myProtocol
什麼的JavaScript送送!
似乎有比頭中的字段只是排名的差異......例如「連接」值不同,就像「起源」一樣,並且「主機」似乎在兩個版本之間使用不同的端口。這些改變是否有所作爲? –
「連接:升級」中的空間將導致握手失敗,它不是拼寫錯誤 – simonc
服務器瞭解websocket協議的哪些變體?握手是針對較老的Hixie變體;這已被棄用,並被許多用途中不兼容的Hybi版本取代。 – simonc