BedrockStreaming / websocket-bench

⛔️ DEPRECATED - nodejs tool to benchmark socket.io and faye websocket server
675 stars 186 forks source link

Testing req-rep patterns #44

Open khelle opened 8 years ago

khelle commented 8 years ago

Hello, I am trying to test req-rep patterns using ws socket.io, but the benchmark generator I wrote does not work:

server

var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);

app.get('/', function(req, res) {
    res.sendfile(__dirname  + '/index.html');
});

io.on('connection', function(socket) {
    socket.on('req', function() {
        socket.emit('ans', 'hello');
    });
});

http.listen(3000, function() {
    console.log('listening on *:3000');
});

generator.js

    /**
     * Send a message (required)
     * @param {client} client connection
     * @param {done} callback function(err) {}
     */
    sendMessage : function(client, done) {
        client.on('ans', function() {
            done();
        });
        client.emit('req', 'hello');
    },

Why is that?