如题,IE8不自带websocket功能,所以寻求使用flash实现websocket功能,然而客户端创建的连接并没有连上服务端,也没有执行onopen甚至onError
11 回复
<script type="text/javascript" src="/ssc/js/websocket/swfobject.js"></script>
<script type="text/javascript" src="/ssc/js/websocket/web_socket.js"></script>
<script type="text/javascript" src="/ssc/js/websocket/jquery.websocket.js"></script>
<script type="text/javascript">
WEB_SOCKET_SWF_LOCATION = "js/websocket/WebSocketMain.swf";
WEB_SOCKET_DEBUG = true;
</script>
public synchronized void initSocketServer() {
try {
if (executorService == null) {
executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 20);
} else {
return;
}
//启动843端口
serverSocket = new ServerSocket(843);
Runnable runnable = new Server();
Thread thread = new Thread(runnable);
thread.start();
} catch (Exception e) {
e.printStackTrace();
}
}
上边这个方案有点乱,一堆乱起八糟的jar和js,还有一种方案是spring+sockjs的方案
https://blog.csdn.net/zzhao114/article/details/60154017
https://blog.csdn.net/john_62/article/details/78208177
但是又不想为了这功能把springMVC整合进来,纠结啊
添加回复
请先登陆