SockJS not working on IE9 (Websockets)

2019-06-27 06:11发布

I am trying to setup an app working with SockJS over STOMP. However, it seems that the connection is not established. I do not have these issues with running all on Chrome, FF and so on.

Is there a way to support this for IE9? Or is it impossible to run websockets with sockjs on IE9? I saw some discussions where people were solving some issues with IE9 and sockjs but none providing a solution to my issue.

BR

2条回答
姐就是有狂的资本
2楼-- · 2019-06-27 06:47

The issue is resolved. SockJS emulates websockets on IE9 with no issue. The only thing that I had to do was to provide absolute path for creating the SockJS object.

Before:

var webSocket = new SockJS('topic/publish');

After:

var webSocket = new SockJS('http://localhost:8080/topic/publish');

Although it was working with Chrome and Firefox, there were issues to run it on IE9 that doesn't support websockets (out of the box).

查看更多
ゆ 、 Hurt°
3楼-- · 2019-06-27 06:52

Internet Explorer 9 does not support websockets http://caniuse.com/websockets.

You can use a polyfill based on Flash like https://github.com/gimite/web-socket-js

查看更多
登录 后发表回答