Skip to content

Commit

Permalink
websocket.py: prefer to send as text
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil Booth committed May 13, 2019
1 parent b91c7ff commit cf51dca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aiorpcx/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ async def process_messages(self):

# API exposed to session
async def write(self, framed_message):
# Prefer to send as text
try:
framed_message = framed_message.decode()
except UnicodeDecodeError:
pass
await self.websocket.send(framed_message)

async def close(self, _force_after=0):
Expand Down

0 comments on commit cf51dca

Please sign in to comment.