diff --git a/package.json b/package.json index 71ca8ee..db61592 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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" } } diff --git a/test/index.js b/test/index.js index 8a2f6ea..5ffde8c 100644 --- a/test/index.js +++ b/test/index.js @@ -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();