Solve the Problem of WebSocket compatibility with IE browser versions,

Source: Internet
Author: User

Solve the Problem of WebSocket compatibility with IE browser versions,

Reprinted please indicate the source: http://www.cnblogs.com/Joanna-Yan/p/7942323.html

When Netty was used for WebSocket development, the test found that the connection was automatically disconnected immediately after some earlier versions of the ie 11 series connected to WebSocket. For example, ie 11.0.38.

1. debugging

Background log printing:

WebSocket Sockets Layer --- WS pipe ID: channelActiveWebSocket channel read0websocket channel channelInactiveWebSocket layer --- WS pipe ID: transmission channels --- WS pipe ID: channelActiveWebSocket channelRead0WebSocket channel ID channelInactiveWebSocket layer --- WS pipe ID: Transmission

The WebSocket client immediately triggers the disconnection after connecting to the server. Why?

Debug, problem lock code block:

2. Thinking

When determining whether the Http protocol can be upgraded to the WebSocket protocol, it is found that the Http Protocol cannot be upgraded to the ws protocol, and an exception is returned.

Does this ie version not support WebSocket? Switch to the javaee-api-7.0.jar or tomcat built-in websocket package test passed, so determine that the version is compatible with WebSocket.

Currently, all browsers support the WebSocket version and the WebSocket version of the server netty is 13. Why?

Test it in different browsers to see what the values of req. getDecoderResult (). isSuccess () and req. headers (). get ("Upgrade") are .!!!

3. Solution

Test results:

Test with other browsers and print the results as follows:True; websocket

The test results are as follows:True; Websocket

The discovery is speechless.WebsocketOfWIt is in uppercase. Why do some versions in the ie 11 series use websocket, which is the same as mainstream browsers, while some earlier versions use Websocket.

This should be a problem with the ie11 series, so there are so many versions.

Of course, the solution to the problem is obvious. Set equals to inclusignorecase.

 

The WebSocket series and Netty series will be added later. If you are interested, pay attention to them.

If this article is helpful to you, please let me know ~

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.