I need some help with socket.io and bacon.JS:
I have on the client side a socket.IO emit event that sends 2 parameters to the server, as shown below:
$("#btn").asEventStream("click").onValue(function(){
socket.emit("event", param1, param2);
});
Then on the server side I need to receive these 2 parameters so I can do stuff with them.
Following the example on this answer, I tried doing something like this:
io.on('connection', function (socket) {
socket.on('error', function (err) {
console.log(err);
});
Bacon.fromEvent(socket, "event", param1, param2)
.filter(function(param1, param2){ return true })
.forEach(function(param1, param2){
doStuff(param1, param2);
});
});
But it didn't work.
Summarizing, I need to receive the event on the server as an EventStream, and use the parameters.
Can anyone help me?