I\'m interested in setting up a Socket.IO server + Rails web application. However, as many are aware, there are not many web servers that support WebSockets. Here have been
Here is a node.js socket.io server. note that this only handles websockets.
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app)
, fs = require('fs')
app.listen(8080);
function handler (req, res) {}
io.sockets.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
socket.on('my other event', function (data) {
console.log(data);
});
});
and the corresponding client:
run node server.js
to start up the node server and request the index.html from rails.
If you need to call rails functions from the websocket server you can communicate over http using either the http node module or this library: https://github.com/mikeal/request