Skip to content

Commit

Permalink
Revert "Correct generating cast messages"
Browse files Browse the repository at this point in the history
This reverts commit f85879c.
  • Loading branch information
emontnemery committed Jan 28, 2024
1 parent f85879c commit ed21ada
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pychromecast/socket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ def _message_to_string(message, data=None):
)


def _json_to_payload(data: dict) -> bytes:
"""Encodes a python value into JSON format."""
return json.dumps(data, ensure_ascii=False).encode("utf8")


@dataclass(frozen=True)
class NetworkAddress:
"""Network address container."""
Expand Down Expand Up @@ -872,7 +877,7 @@ def send_message(
cast_channel_pb2.CastMessage.STRING # pylint: disable=no-member
)
msg.namespace = namespace
msg.payload_utf8 = json.dumps(data, ensure_ascii=False)
msg.payload_utf8 = _json_to_payload(data)

# prepend message with Big-Endian 4 byte payload size
be_size = pack(">I", msg.ByteSize())
Expand Down

0 comments on commit ed21ada

Please sign in to comment.