Skip to content

Commit

Permalink
Use Webocket.send_binary() instead of Websocket.send()
Browse files Browse the repository at this point in the history
websockify dropped support for text frames awhile back [1][2], possibly
as of version 0.9.0 [3]. Attempts to send text frames to a sufficiently
new websockify server result in the following error returned:

  Unsupported: Text frames are not supported

and then the server closes the connection.

This changes the client to call Webocket.send_binary() [4] instead of
Websocket.send() in order to send binary data rather than text.

websockify has (always?) supported receiving binary data so this should
be backward compatible with older versions.

Closes larsks#4

[1] novnc/websockify#365
[2] novnc/websockify@8eb5cb0
[3] novnc/websockify@8a69762
[4] https://websocket-client.readthedocs.io/en/latest/core.html#websocket._core.WebSocket.send_binary
  • Loading branch information
melwitt committed Jun 21, 2022
1 parent ea1ec04 commit f2357ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions novaconsole/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def handle_stdin(self, event):
raise UserExit()
elif self.read_escape:
self.read_escape = False
self.ws.send(self.escape)
self.ws.send_binary(self.escape)

self.ws.send(data)
self.ws.send_binary(data)

if data == '\r':
self.start_of_line = True
Expand Down

0 comments on commit f2357ac

Please sign in to comment.