これはテストケースです...
app.js
var express = require('express'),
http = require('http'),
//other variables
var app = express();
var server = http.createServer(app);
var io = require("socket.io").listen(server)
io.sockets.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
});
html_index.js
$(document).ready(function()
{
var socket = io.connect();
socket.on('news', function (data) {
console.log(data);
});
});
このエラーが発生します
WebSocket connection to 'ws://localhost:26000/socket.io/1/websocket/%3Ch2%3Efile%20not%20found!%20error%20404!%3C/h2%3E' failed: WebSocket is closed before the connection is established. socket.io.js:2438
WS.close socket.io.js:2438
Socket.onDisconnect socket.io.js:1967
Transport.onDisconnect socket.io.js:1362
Transport.onClose socket.io.js:1456
(anonymous function)
使っています
express 3
socket.io 0.9
nodejs 0.10