Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Testing req-rep patterns #44

Open
khelle opened this issue Apr 22, 2016 · 0 comments
Open

Testing req-rep patterns #44

khelle opened this issue Apr 22, 2016 · 0 comments

Comments

@khelle
Copy link

khelle commented Apr 22, 2016

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant