var url ='ws://'+window.location.host + '/InstantMessaging/chatWebSocketServlet';
var socket = io.connect(url);
socket.on('connect', function () {
alert('connect');
// chat socket connected
});
socket.on('error', function (e) {
alert('e:'+e);
// chat socket connected
});
在error对应的方法里总是报访问的资源不存在, The requested resource (/socket.io/1/) is not available. 但我实际访问的应该是ws://localhost:8080/InstantMessaging/charWebSocketServlet? socket.io 客户端版本为0.9.9-4