@@ -50,9 +50,6 @@ class AsyncServer(base_server.BaseServer):
5050 default is `['/']`, which always accepts connections to
5151 the default namespace. Set to `'*'` to accept all
5252 namespaces.
53- :param serializer_args: A mapping of additional parameters to pass to
54- the serializer. The content of this dictionary
55- depends on the selected serialization method.
5653 :param kwargs: Connection parameters for the underlying Engine.IO server.
5754
5855 The Engine.IO configuration supports the following settings:
@@ -428,7 +425,7 @@ async def disconnect(self, sid, namespace=None, ignore_queue=False):
428425 if delete_it :
429426 self .logger .info ('Disconnecting %s [%s]' , sid , namespace )
430427 eio_sid = self .manager .pre_disconnect (sid , namespace = namespace )
431- await self ._send_packet (eio_sid , self ._create_packet (
428+ await self ._send_packet (eio_sid , self .packet_class (
432429 packet .DISCONNECT , namespace = namespace ))
433430 await self ._trigger_event ('disconnect' , namespace , sid ,
434431 self .reason .SERVER_DISCONNECT )
@@ -541,13 +538,13 @@ async def _handle_connect(self, eio_sid, namespace, data):
541538 or self .namespaces == '*' or namespace in self .namespaces :
542539 sid = await self .manager .connect (eio_sid , namespace )
543540 if sid is None :
544- await self ._send_packet (eio_sid , self ._create_packet (
541+ await self ._send_packet (eio_sid , self .packet_class (
545542 packet .CONNECT_ERROR , data = 'Unable to connect' ,
546543 namespace = namespace ))
547544 return
548545
549546 if self .always_connect :
550- await self ._send_packet (eio_sid , self ._create_packet (
547+ await self ._send_packet (eio_sid , self .packet_class (
551548 packet .CONNECT , {'sid' : sid }, namespace = namespace ))
552549 fail_reason = exceptions .ConnectionRefusedError ().error_args
553550 try :
@@ -571,15 +568,15 @@ async def _handle_connect(self, eio_sid, namespace, data):
571568 if success is False :
572569 if self .always_connect :
573570 self .manager .pre_disconnect (sid , namespace )
574- await self ._send_packet (eio_sid , self ._create_packet (
571+ await self ._send_packet (eio_sid , self .packet_class (
575572 packet .DISCONNECT , data = fail_reason , namespace = namespace ))
576573 else :
577- await self ._send_packet (eio_sid , self ._create_packet (
574+ await self ._send_packet (eio_sid , self .packet_class (
578575 packet .CONNECT_ERROR , data = fail_reason ,
579576 namespace = namespace ))
580577 await self .manager .disconnect (sid , namespace , ignore_queue = True )
581578 elif not self .always_connect :
582- await self ._send_packet (eio_sid , self ._create_packet (
579+ await self ._send_packet (eio_sid , self .packet_class (
583580 packet .CONNECT , {'sid' : sid }, namespace = namespace ))
584581
585582 async def _handle_disconnect (self , eio_sid , namespace , reason = None ):
@@ -625,7 +622,7 @@ async def _handle_event_internal(self, server, sid, eio_sid, data,
625622 data = list (r )
626623 else :
627624 data = [r ]
628- await server ._send_packet (eio_sid , self ._create_packet (
625+ await server ._send_packet (eio_sid , self .packet_class (
629626 packet .ACK , namespace = namespace , id = id , data = data ))
630627
631628 async def _handle_ack (self , eio_sid , namespace , id , data ):
@@ -689,7 +686,7 @@ async def _handle_eio_message(self, eio_sid, data):
689686 await self ._handle_ack (eio_sid , pkt .namespace , pkt .id ,
690687 pkt .data )
691688 else :
692- pkt = self ._create_packet (encoded_packet = data )
689+ pkt = self .packet_class (encoded_packet = data )
693690 if pkt .packet_type == packet .CONNECT :
694691 await self ._handle_connect (eio_sid , pkt .namespace , pkt .data )
695692 elif pkt .packet_type == packet .DISCONNECT :
0 commit comments