geddy 프레임 워크 (기본 채팅 예제)를 사용하여 실시간 응용 프로그램을 만들고 있습니다. 하지만 클라이언트가 연결을 시도 할 때 오류가 발생합니다.socket.io 오류가있는 geddy
var io = require('socket.io').listen(geddy.server);
io.sockets.on('connection', function (socket) {
console.log("Good!");
socket.emit('new', { message: 'world' });
socket.on('newMessage', function (data) {
console.log(data);
});
});
와 클라이언트 측 코드 :
$(document).ready(function(){
startSockets();
});
function startSockets(){
var socket = io.connect('http://localhost:4004');
socket.on('new', function (data) {
alert(data);
//socket.emit('newMessage', { my: 'data' });
});
}
내가 로컬 호스트에 연결을 시도 : 여기
는 서버 측합니다 (init.js로 파일에 대한) 코드의 4004/나는 다음이 경고를 얻을 : 크롬 콘솔 외에debug - setting request GET /socket.io/1/websocket/G_GapksVv1J4iBZIUVe3
debug - set heartbeat interval for client G_GapksVv1J4iBZIUVe3
debug - websocket writing 7:::1+0
warn - client not handshaken client should reconnect
info - transport end (error)
debug - set close timeout for client G_GapksVv1J4iBZIUVe3
debug - cleared close timeout for client G_GapksVv1J4iBZIUVe3
debug - cleared heartbeat interval for client G_GapksVv1J4iBZIUVe3
debug - discarding transport
이 오류를 제공합니다 :
WebSocket is closed before the connection is established.
나는 무엇이 이들을 일으킬 수 있는지 알지 못합니다. 어떤 아이디어?