File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -619,6 +619,30 @@ describe('socket.io', function(){
619
619
} ) ;
620
620
} ) ;
621
621
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
+
622
646
it ( 'should emit events with callbacks' , function ( done ) {
623
647
var srv = http ( ) ;
624
648
var sio = io ( srv ) ;
You can’t perform that action at this time.
0 commit comments