I'm trying to:
build a listening for the 'answer' event on the client, which will send us both the question and answer, which we want to broadcast out to the rest of the connected clients.
app.js =
var express = require('express');
var app = express.createServer();
var socket = require('socket.io');
var io = socket.listen(app);
io.sockets.on('connection', function(client) {
console.log("Client connected...");
// listen for answers here
client.on('question', function(question) {
client.get('question_asked', function(asked) {
if(!asked) {
client.set('question_asked', true);
client.broadcast.emit('question', question);
}
});
});
});