@@ -89,7 +89,7 @@ def __init__(self, client_manager=None, logger=False, binary=False,
8989 self .handlers = {}
9090 self .namespace_handlers = {}
9191
92- self ._binary_packet = []
92+ self ._binary_packet = {}
9393
9494 if not isinstance (logger , bool ):
9595 self .logger = logger
@@ -491,10 +491,10 @@ def _handle_eio_connect(self, sid, environ):
491491
492492 def _handle_eio_message (self , sid , data ):
493493 """Dispatch Engine.IO messages."""
494- if len ( self ._binary_packet ) :
495- pkt = self ._binary_packet [0 ]
494+ if sid in self ._binary_packet :
495+ pkt = self ._binary_packet [sid ]
496496 if pkt .add_attachment (data ):
497- self ._binary_packet . pop ( 0 )
497+ del self ._binary_packet [ sid ]
498498 if pkt .packet_type == packet .BINARY_EVENT :
499499 self ._handle_event (sid , pkt .namespace , pkt .id , pkt .data )
500500 else :
@@ -511,7 +511,7 @@ def _handle_eio_message(self, sid, data):
511511 self ._handle_ack (sid , pkt .namespace , pkt .id , pkt .data )
512512 elif pkt .packet_type == packet .BINARY_EVENT or \
513513 pkt .packet_type == packet .BINARY_ACK :
514- self ._binary_packet . append ( pkt )
514+ self ._binary_packet [ sid ] = pkt
515515 elif pkt .packet_type == packet .ERROR :
516516 raise ValueError ('Unexpected ERROR packet.' )
517517 else :
0 commit comments