Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5812ddf

Browse files
author
Kevin Roark
committed
added the client emit-buffer test
1 parent 1bbc395 commit 5812ddf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/socket.io.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,30 @@ describe('socket.io', function(){
619619
});
620620
});
621621

622+
it('should receive all events emitted from namespaced client immediately and in order', function(done) {
623+
var srv = http();
624+
var sio = io(srv);
625+
var total = 0;
626+
srv.listen(function(){
627+
sio.of('/chat', function(s){
628+
s.on('hi', function(letter){
629+
total++;
630+
if (total == 2 && letter == 'b') {
631+
done();
632+
} else if (total == 1 && letter != 'a') {
633+
throw new Error('events out of order');
634+
}
635+
});
636+
});
637+
638+
var chat = client(srv, '/chat');
639+
chat.emit('hi', 'a');
640+
setTimeout(function() {
641+
chat.emit('hi', 'b');
642+
}, 50);
643+
});
644+
});
645+
622646
it('should emit events with callbacks', function(done){
623647
var srv = http();
624648
var sio = io(srv);

0 commit comments

Comments
 (0)