简体   繁体   中英

Unexpected response code 426

I am using Tomcat websockets and it is working fine in all browsers except in Safari where it is throwing Unexpected response code 426 error.
I went through web inspector and tried to google it to find solution to this issue.
But did not find any solution to it.
I am using Safari 5.1.7. Any help would be greatly appreciated.
Thanks in Advance

The 426 response code on upgrade is appropriate for when your websocket client is not conforming to the WebSocket standard RFC-6455.

See Section 4.2.2. Sending the Server's Opening Handshake. 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.

What is going on, is that Safari 5.x isn't using the final WebSocket spec, but rather an early experimental draft version, something that tomcat does not correctly support. Few production servers do anymore.

For more information see What browsers support HTML5 WebSocket API? and http://caniuse.com/websockets

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM