意外的响应代码426

时间:2013-12-14 13:07:30

标签: javascript safari websocket

我正在使用Tomcat websockets并且它在所有浏览器中都运行正常,但在Safari中它会抛出意外的响应代码426错误。
我通过网络检查员并试图谷歌它找到这个问题的解决方案 但没有找到任何解决方案。
我正在使用Safari 5.1.7。任何帮助将不胜感激 在此先感谢

1 个答案:

答案 0 :(得分:4)

升级时的426响应代码适用于您的websocket客户端不符合WebSocket标准RFC-6455的时候。

见4.2.2节。发送服务器的开放握手。 http://tools.ietf.org/html/rfc6455#section-4.2.2

   /version/
      The |Sec-WebSocket-Version| header field in the client's
      handshake includes the version of the WebSocket Protocol with
      which the client is attempting to communicate.  If this
      version does not match a version understood by the server, the
      server MUST abort the WebSocket handshake described in this
      section and instead send an appropriate HTTP error code (such
      as 426 Upgrade Required) and a |Sec-WebSocket-Version| header
      field indicating the version(s) the server is capable of
      understanding.

发生了什么,是Safari 5.x没有使用最终的WebSocket规范,而是早期的实验性草案版本,这是tomcat无法正确支持的。很少有生产服务器再做。

有关详细信息,请参阅What browsers support HTML5 WebSocket API?http://caniuse.com/websockets

相关问题