Browse Source

Fix Server and AsyncServer when emitting no data (#420)

pull/449/head
Aaron 5 years ago
committed by GitHub
parent
commit
e2242ce40e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      socketio/asyncio_server.py
  2. 4
      socketio/server.py

4
socketio/asyncio_server.py

@ -362,8 +362,10 @@ class AsyncServer(server.Server):
# as a single argument # as a single argument
if isinstance(data, tuple): if isinstance(data, tuple):
data = list(data) data = list(data)
else: elif data is not None:
data = [data] data = [data]
else:
data = []
await self._send_packet(sid, packet.Packet( await self._send_packet(sid, packet.Packet(
packet.EVENT, namespace=namespace, data=[event] + data, id=id, packet.EVENT, namespace=namespace, data=[event] + data, id=id,
binary=None)) binary=None))

4
socketio/server.py

@ -573,8 +573,10 @@ class Server(object):
# as a single argument # as a single argument
if isinstance(data, tuple): if isinstance(data, tuple):
data = list(data) data = list(data)
else: elif data is not None:
data = [data] data = [data]
else:
data = []
self._send_packet(sid, packet.Packet(packet.EVENT, namespace=namespace, self._send_packet(sid, packet.Packet(packet.EVENT, namespace=namespace,
data=[event] + data, id=id, data=[event] + data, id=id,
binary=binary)) binary=binary))

Loading…
Cancel
Save