python-websocket-server
python-websocket-server copied to clipboard
UnicodeDecodeError
message = self.request.recv(1024).decode().strip() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa7 in position 4: invalid start byte
Yea I have the same problem
+1, also running into this
This appears due to trying to utilize an SSL on the server. I received the same message. Have you guys found a way around this? Are you also utilizing nginx in your projects?
When attempting a proxy_pass, I then receive a new error:
Traceback (most recent call last):
File "/usr/lib/python3.6/socketserver.py", line 721, in __init__
self.handle()
File "/home/damian/hopemud/websocket_server/websocket_server.py", line 199, in handle
self.handshake()
File "/home/damian/hopemud/websocket_server/websocket_server.py", line 337, in handshake
assert headers['upgrade'].lower() == 'websocket'
KeyError: 'upgrade'
I had the same error I have proxied the websocket through apache, that manages ssl , with the following in VirtualHost (the websocket server runs on port 13100)
<VirtualHost :443> ... RewriteEngine on RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC] RewriteRule . ws://yourserver.com:13100%{REQUEST_URI} [P] ...
and my client simply connects to
wss://yourserver.com
I accidentally tried to connect through 'wss' to my local server, which hadn't any certificates and that was causing this error. Changing to 'ws' protocol resolved this