Xpra: Ticket #2120: websocket-client vs websockify>0.8 error: Text frames are not supported

See ticket:2104#comment:4.

Let's make it work and improve the error messages so we can see the reason for the failure without using tcpdump..

Server log:

2019-01-23 23:58:26,107 new_websocket_client() calling <function new_websocket_client at 0x7f479687a398>, request=<websockify.websocket.WebSocket object at 0x7f47a07269d0> (<class 'websockify.websocket.WebSocket'>)
2019-01-23 23:58:26,108 new_websocket_client(<xpra.server.websocket.WSRequestHandler instance at 0x7f47969761b8>) socket=<socket._socketobject object at 0x7f47a08a64b0>
2019-01-23 23:58:26,201 waiting for data:
2019-01-23 23:58:26,201 waiting for data:
2019-01-23 23:58:26,202 waiting for data:
2019-01-23 23:58:26,202 waiting for data:
2019-01-23 23:58:26,202 waiting for data:
2019-01-23 23:58:26,202 waiting for data:
2019-01-23 23:58:26,202 waiting for data:
2019-01-23 23:58:26,202 waiting for data:
2019-01-23 23:58:26,206 waiting for data:
2019-01-23 23:58:26,206 Warning: websocket connection already closed:
2019-01-23 23:58:26,206  1000: Locally initiated close
2019-01-23 23:58:26,207 error closing <websockify.websocket.WebSocket object at 0x7f47a07269d0>
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/server/websocket.py", line 348, in close
    request.close()
  File "/usr/lib/python2.7/site-packages/websockify-0.8.0-py2.7.egg/websockify/websocket.py", line 497, in close
    self._close()
  File "/usr/lib/python2.7/site-packages/websockify-0.8.0-py2.7.egg/websockify/websocket.py", line 695, in _close
    self.socket.close()
AttributeError: 'NoneType' object has no attribute 'close'

Client log:

2019-01-23 23:58:26,375 websocket ws://localhost:10000/.close() for socket=<websocket._core.WebSocket object at 0x7f4965f3e310>
2019-01-23 23:58:26,376 websocket ws://localhost:10000/.close() done
2019-01-23 23:58:26,376 Error: failed to receive anything, not an xpra server?
2019-01-23 23:58:26,376   could also be the wrong protocol, username, password or port
2019-01-23 23:58:26,376   or the session was not found
2019-01-23 23:58:26,377 Connection lost

ngrep capture:

T 127.0.0.1:10000 -> 127.0.0.1:47424 [AP] #12
  88 2c 03 eb 55 6e 73 75    70 70 6f 72 74 65 64 3a    .,..Unsupported:
  20 54 65 78 74 20 66 72    61 6d 65 73 20 61 72 65     Text frames are
  20 6e 6f 74 20 73 75 70    70 6f 72 74 65 64           not supported
####
T 127.0.0.1:47424 -> 127.0.0.1:10000 [AP] #16
  88 82 cc 4c 22 6a cf a4                               ...L"j..


Thu, 24 Jan 2019 16:07:32 GMT - Antoine Martin: status changed

Alternatively, we could switch to using websockify in client mode instead of websocket-client - which would also reduce the number of dependencies.


Thu, 07 Feb 2019 15:16:07 GMT - Antoine Martin: status changed; resolution set

Fixed by not using websockify or websocket-client! See #2121


Sat, 23 Jan 2021 05:42:44 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2120