Let the outbound payload be binary

This commit is contained in:
office-gateway 2018-03-05 16:41:11 +01:00
parent e9a08fa1d9
commit f81f415da8

View file

@ -219,6 +219,10 @@ class Serializer(object):
fmt += "B" fmt += "B"
values.append(defines.PAYLOAD_MARKER) values.append(defines.PAYLOAD_MARKER)
if isinstance(payload, bytes):
fmt += str(len(payload)) + "s"
values.append(payload)
else:
fmt += str(len(bytes(payload, "utf-8"))) + "s" fmt += str(len(bytes(payload, "utf-8"))) + "s"
values.append(bytes(payload, "utf-8")) values.append(bytes(payload, "utf-8"))
# for b in str(payload): # for b in str(payload):