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 ~