|
@ -433,7 +433,7 @@ class AsyncServer(server.Server): |
|
|
else: |
|
|
else: |
|
|
await self.eio.send(eio_sid, encoded_packet) |
|
|
await self.eio.send(eio_sid, encoded_packet) |
|
|
|
|
|
|
|
|
async def _handle_connect(self, eio_sid, namespace): |
|
|
async def _handle_connect(self, eio_sid, namespace, data): |
|
|
"""Handle a client connection request.""" |
|
|
"""Handle a client connection request.""" |
|
|
namespace = namespace or '/' |
|
|
namespace = namespace or '/' |
|
|
sid = self.manager.connect(eio_sid, namespace) |
|
|
sid = self.manager.connect(eio_sid, namespace) |
|
@ -442,8 +442,16 @@ class AsyncServer(server.Server): |
|
|
packet.CONNECT, {'sid': sid}, namespace=namespace)) |
|
|
packet.CONNECT, {'sid': sid}, namespace=namespace)) |
|
|
fail_reason = exceptions.ConnectionRefusedError().error_args |
|
|
fail_reason = exceptions.ConnectionRefusedError().error_args |
|
|
try: |
|
|
try: |
|
|
success = await self._trigger_event('connect', namespace, sid, |
|
|
if data: |
|
|
self.environ[eio_sid]) |
|
|
success = await self._trigger_event( |
|
|
|
|
|
'connect', namespace, sid, self.environ[eio_sid], data) |
|
|
|
|
|
else: |
|
|
|
|
|
try: |
|
|
|
|
|
success = await self._trigger_event( |
|
|
|
|
|
'connect', namespace, sid, self.environ[eio_sid]) |
|
|
|
|
|
except TypeError: |
|
|
|
|
|
success = await self._trigger_event( |
|
|
|
|
|
'connect', namespace, sid, self.environ[eio_sid], None) |
|
|
except exceptions.ConnectionRefusedError as exc: |
|
|
except exceptions.ConnectionRefusedError as exc: |
|
|
fail_reason = exc.error_args |
|
|
fail_reason = exc.error_args |
|
|
success = False |
|
|
success = False |
|
@ -552,7 +560,7 @@ class AsyncServer(server.Server): |
|
|
else: |
|
|
else: |
|
|
pkt = packet.Packet(encoded_packet=data) |
|
|
pkt = packet.Packet(encoded_packet=data) |
|
|
if pkt.packet_type == packet.CONNECT: |
|
|
if pkt.packet_type == packet.CONNECT: |
|
|
await self._handle_connect(eio_sid, pkt.namespace) |
|
|
await self._handle_connect(eio_sid, pkt.namespace, pkt.data) |
|
|
elif pkt.packet_type == packet.DISCONNECT: |
|
|
elif pkt.packet_type == packet.DISCONNECT: |
|
|
await self._handle_disconnect(eio_sid, pkt.namespace) |
|
|
await self._handle_disconnect(eio_sid, pkt.namespace) |
|
|
elif pkt.packet_type == packet.EVENT: |
|
|
elif pkt.packet_type == packet.EVENT: |
|
|