Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"debug": "~2.6.4",
"notepack.io": "~1.0.1",
"notepack.io": "~2.1.0",
"redis": "2.6.3",
"socket.io-parser": "2.3.2"
},
Expand All @@ -24,6 +24,6 @@
"expect.js": "~0.3.1",
"socket.io": "~2.0.1",
"socket.io-client": "~2.0.1",
"socket.io-redis": "~5.0.0"
"socket.io-redis": "^5.1.0"
}
}
26 changes: 26 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,32 @@ function client(srv, nsp, opts){

describe('emitter', function() {
var srv;

it('should be able to emit any kind of data', function(done){
srv = http();
var sio = io(srv, {adapter: redisAdapter()});
srv.listen();

var cli = client(srv, { forceNew: true });
var emitter = ioe({ host: 'localhost', port: '6379' });

var buffer = new Buffer('asdfasdf', 'utf8');
var arraybuffer = Uint8Array.of(1, 2, 3, 4).buffer;

cli.on('connect', function () {
emitter.emit('payload', 1, '2', [3], buffer, arraybuffer);
});

cli.on('payload', function(a, b, c, d, e) {
expect(a).to.eql(1);
expect(b).to.eql('2');
expect(c).to.eql([3]);
expect(d).to.eql(buffer);
expect(e).to.eql(Buffer.from(arraybuffer)); // buffer on the nodejs client-side
done();
});
});

describe('in namespaces', function(){
beforeEach(function() {
var pub = redis.createClient();
Expand Down